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
| List<ModelAnnotation<?>> annotations = new ArrayList<ModelAnnotation<?>>(); | |
| annotations.add( new ModelAnnotation<Measure>( "field1", new Measure() ) ); | |
| annotations.add( new ModelAnnotation<Attribute>( "field2", new Attribute() ) ); | |
| annotations.add( new ModelAnnotation<Dimension>( "field2", new Dimension() ) ); | |
| annotations.add( new ModelAnnotation<HierarchyLevel>( "field3", new HierarchyLevel() ) ); | |
| annotations.add( new ModelAnnotation<Measure>( "field4", new Measure() ) ); | |
| for ( ModelAnnotation<?> modelAnnotation : annotations ) { | |
| // do something with modelAnnotation - what is it? a measure, dimension, etc.... | |
| } |
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
| if ( modelAnnotation.isMeasure() ) { | |
| ModelAnnotation<Measure> measureAnnotation = (ModelAnnotation<Measure>) modelAnnotation; | |
| } |
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
| plugins { | |
| id 'org.springframework.boot' version '1.5.2.RELEASE' | |
| } | |
| apply plugin: 'groovy' | |
| repositories { | |
| jcenter() | |
| mavenCentral() | |
| } |
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
| @Component | |
| @CompileStatic | |
| @Log4j | |
| class DispatcherService { | |
| @Autowired | |
| List<Handler> handlers | |
| Response dispatch(Request request) { | |
| log.info("request: ${request}") |
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
| @Entity | |
| @ToString | |
| @CompileStatic | |
| class User { | |
| @Id | |
| @GeneratedValue(strategy = GenerationType.AUTO) | |
| Long id | |
| String firstName | |
| String lastName |
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
| import com.serverless.persistence.entities.User | |
| import org.springframework.data.repository.CrudRepository | |
| interface UserRepository extends CrudRepository<User, Long> { | |
| List<User> findByLastName(String lastName) | |
| } |
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
| interface Handler { | |
| boolean route(Request request) | |
| Response respond(Request request) | |
| } |
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
| @Component | |
| @Log4j | |
| @CompileStatic | |
| class FindUsersByLastName implements Handler { | |
| @Autowired | |
| private UserRepository userRepository | |
| @Override | |
| boolean route(final Request request) { |
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
| @Component | |
| @Log4j | |
| @CompileStatic | |
| class GetUsers implements Handler { | |
| @Autowired | |
| private UserRepository userRepository | |
| @Override | |
| boolean route(final Request request) { |
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
| @Component | |
| @Log4j | |
| @CompileStatic | |
| class CreateUser implements Handler { | |
| @Autowired | |
| private UserRepository userRepository | |
| @Override | |
| boolean route(Request request) { |
OlderNewer