Tutorial by Examples: anno

When declaring an annotation, meta-info can be included using the following meta-annotations: @Target: specifies the possible kinds of elements which can be annotated with the annotation (classes, functions, properties, expressions etc.) @Retention specifies whether the annotation is store...
Add any JSR 303 implementation to your classpath. Popular one used is Hibernate validator from Hibernate. <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>4.2.0.Final</version> </dependen...
Except main @conditional annotation there are set of similar annotation to be used for different cases. Class conditions The @ConditionalOnClass and @ConditionalOnMissingClass annotations allows configuration to be included based on the presence or absence of specific classes. E.g. when OObjectDa...
If You have Role: +-----------------------------+ | roleId | name | discription | +-----------------------------+ Rights: +-----------------------------+ | rightId | name | discription| +-----------------------------+ rightrole +------------------+ | roleId | rightId | +----------...
public class Foo { private String name; public Foo(@NonNull String name){...}; ... } Here @NonNull is annotation which is processed compile time by the android studio to warn you that the particular function needs non null parameter.
There are three types of annotations. Marker Annotation - annotation that has no method @interface CustomAnnotation {} Single-Value Annotation - annotation that has one method @interface CustomAnnotation { int value(); } Multi-Value Annotation - annotation that...
For creating custom annotations we need to decide Target - on which these annotations will work on like field level, method level, type level etc. Retention - to what level annotation will be available. For this, we have built in custom annotations. Check out these mostly used ones: @Target...
We use type annotations to avoid ambiguity. Type applications can be used for the same purpose. For example x :: Num a => a x = 5 main :: IO () main = print x This code has an ambiguity error. We know that a has a Num instance, and in order to print it we know it needs a Show instance. T...
Data annotations are a way of adding more contextual information to classes or members of a class. There are three main categories of annotations: Validation Attributes: add validation criteria to data Display Attributes: specify how the data should be displayed to the user Modelling Attributes...
An Annotation parameter can accept multiple values if it is defined as an array. For example the standard annotation @SuppressWarnings is defined like this: public @interface SuppressWarnings { String[] value(); } The value parameter is an array of Strings. You can set multiple values by u...
Swift: mapView.showAnnotations(mapView.annotations, animated: true) Objective-C: [mapView showAnnotations:mapView.annotations animated:YES]; Demo:

Page 4 of 4