-
-
Save emmanuelbernard/6070079 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConstraintMapping mapping = config.createConstraintMapping(); | |
mapping.type( GreetingService.class ) | |
.method( "greet", User.class ) | |
.returnValue() | |
.valid() | |
.convertGroup( Default.class ).to( User.class ) | |
.convertGroup( Foo.class ).to( Bar.class ); | |
//more "fluent" name? | |
ConstraintMapping mapping = config.createConstraintMapping(); | |
mapping.type( GreetingService.class ) | |
.method( "greet", User.class ) | |
.returnValue() | |
.valid() | |
.convertingFrom( Default.class ).to( User.class ) | |
.convertingFrom( Foo.class ).to( Bar.class ); | |
// Emmanuel's variant | |
ConstraintMapping mapping = config.createConstraintMapping(); | |
mapping.type( GreetingService.class ) | |
.method( "greet", User.class ) | |
.returnValue() | |
.valid() | |
.convertGroup( Default.class ).to( User.class ) | |
.convertGroup( Foo.class ).to( Bar.class ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//using an object for representing conversions | |
ConstraintMapping mapping = config.createConstraintMapping(); | |
mapping.type( GreetingService.class ) | |
.method( "greet", User.class ) | |
.returnValue() | |
.valid() | |
.convertGroup( new GroupConversion( Default.class, User.class ) ) | |
.convertGroup( new GroupConversion( Foo.class, Bar.class ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//using an object within valid(GroupConversion... conversions) | |
ConstraintMapping mapping = config.createConstraintMapping(); | |
mapping.type( GreetingService.class ) | |
.method( "greet", User.class ) | |
.returnValue() | |
.valid( | |
new GroupConversion( Default.class, User.class ), | |
new GroupConversion( Foo.class, Bar.class ) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConstraintMapping mapping = config.createConstraintMapping(); | |
mapping.type( GreetingService.class ) | |
.method( "greet", User.class ) | |
.returnValue() | |
.valid() | |
.withConversion( Default.class, User.class ) | |
.withConversion( Foo.class, Bar.class ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment