EzyFox's Annotations

EzyFox provides a list of annotations for bean management, data binding and database.
# Annotation Scopes Description
1EzyAutoImplInterfaceIndicates the annotated interface will be implemented by framework
2EzyFeatureClass, MethodMaps a feature name to a class or a method
3EzyIdClass, Field, MethodIndicates the class will be a id class for a entity. With a field and a method, they will be the id property for an entity
4EzyImportClassTo import classses to the bean management
5EzyKeyValueAnnotationTo provides a property for a bean
6EzyManagementClassIndicate the annotated class will be a management class
7EzyPackagesToScanClassProvides packages to scan
8EzyPaymentClass, MethodIndicates the annotated class or method will be pyament
9EzyPropertyField, MethodMap a property to a field or a setter method
# Annotation Scopes Description
1EzyAutoBindField, Method, ConstructorBind a bean to a field, a method or bind beans to a contructor
2EzyBeanPackagesToScanClassProvides packages to scan
3EzyConfigurationClass, Field, MethodIndicates the class will be a configuration class, the instance of a class that's annotated with EzyConfiguration annotation will run after EzyConfigurationBefore and before EzyConfigurationAfter
4EzyConfigurationAfterClassIndicates the class will be a configuration class, the instance of a class that's annotated with EzyConfigurationAfter annotation will run after EzyConfigurationBefore and EzyConfiguration
5EzyConfigurationBeforeAnnotationIndicates the class will be a configuration class, the instance of a class that's annotated with EzyConfigurationBefore annotation will run before EzyConfiguration and EzyConfigurationAfter
6EzyDisableAutoConfigurationClassAllows disable auto configuration
7EzyExclusiveClassesConfigurationClassTo exclude classes from bean management
8EzyPostInitMethodCall after a bean initialized
9EzyPropertiesBeanClassIndicates the annotated class or value class is mapped to a properties
10EzyPropertiesBeansClassProvides a list of EzyPropertiesBean annotations
11EzyPropertiesSourcesClassProvides a list of properties files
12EzyPrototypeClass, Field, MethodIndicates instance of the annotated class, field, method will be prototype
13EzySingletonClass, Field, MethodIndicates instance of the annotated class, field, method will be singleton
# Annotation Scopes Description
1EzyArrayBindingClassIndicates the annotated class will be bound to an array
2EzyBindingPackagesToScanClassProvides packages to scan for binding context
3EzyConfigurationClassConfiguration for binding context
4EzyIgnoreField, MethodIgnore the annotated field and method from binding
5EzyIndexField, MethodProvides index for array binding
6EzyObjectBindingClassIndicates the annotated class will be bound to an object
7EzyPostReadMethodCall after a binding
8EzyReaderField, MethodSpecifics reader for a field or a method.
9EzyReaderImplClassIndicates the annotated class is a reader class
10EzyTemplateImplClassIndicates the annotated class is a reader or writer class or the both
11EzyValueField, MethodProvides key name for object binding
12EzyWriterField, MethodSpecifics writer for a field or a method
13EzyWriterImplClassIndicates the annotated class is a writer class
# Annotation Scopes Description
1EzyCollectionClassIndicates the annotated clas will be an entity class for NoSQL like MongoDB
2EzyCollectionIdClass, FieldIndicates the annotated class will be an entity's id class, or the annotated filed will be an id field
3EzyMapstoreClassIndicates the class will be a map store class (store data to a database or somewhere)
4EzyNamedQueryClassMap a named query to a result class
5EzyQueryMethodMap a query to a repository's method
6EzyManagementClassIndicate the annotated class will be a management class
7EzyQueryResultClassIndicates the annotated class will be a query result class
8EzyRepositoryClass or InterfaceIndicates the annotated class or interface will be a repository
9EzyResultDeserializedClassIndicates the annotated will be a result deserializer class
10EzyTransactionalMethodIndicates the annotated method will be run in a transaction

1. EzyAutoImpl

When you annotate a interface with EzyAutoImpl annotation, a framework will recognize this interface and implement it automatically. In this example ChatMessageRepo will be implemented by ezydata-mongodb.
@EzyAutoImpl("messageRepo")
public interface ChatMessageRepo extends EzyMongoRepository<Long, ChatMessage> {}

2. EzyFeature

When you want to map a feature name with an API, a method or a class (apply for all methods in the class), you can use EzyFeature annotation. In MetricsController every APIs will be mapped with a feature name:
@Controller
public class MetricsController implements ManagementController {

    @EzyFeature(DEFAULT_FEATURE_NAME)
    @DoGet("/management/start-time")
    public long getStartTime() {}
}

3. EzyId

When you have a composite id in an entity, you can use EzyId annotation for the id class, example ChatChannelUserId:
@EzyId
public class ChatChannelUserId {
    private long channelId;
    private String user;
}
If you want to indicate a field or a methods (getter/setter) is the id property of an entity, you can use this annotation, example ChatChannel:
@EzyId
public class ChatChannelUserId {
    private long channelId;
    private String user;
}

4. EzyImport

Sometimes, you don't want to scan a package, you just want to include some classes to the bean management, you can use EzyImport annotation, example:
@EzyImport(DatabaseConfiguration.class)
public class Configuration {}

5. EzyKeyValue

If you want to add some additional properties to a bean, you can use EzyKeyValue annotation, example:
@EzySingleton(properties = {
    @EzyKeyValue(key = "type", value = "request_listener"),
    @EzyKeyValue(key = "cmd", value = "1"),
    @EzyKeyValue(key = "priority", value = "1")
})
public class HelloRequestHandler {}

6. EzyManagement

If you want to indicate an API or a method or a class (apply to all methods in the classes) is management, you can use EzyManagement annotation, example:
@Controller("/api/v1")
public class MetricsController {

    @EzyManagement
    @DoGet("/metrics")
    public Object metricsGet() {}
}

7. EzyPackagesToScan

Sometimes you will need include one or more packages to scan beans. you can use EzyPackagesToScan, example:
@EzyPackagesToScan("com.example.app.api")
public class GlobalConfig {}

8. EzyPayment

If you want to indicate an API or a method or a class (apply to all methods in the classes) is payment, you can use EzyPayment annotation, example:
@EzyPayment
@Controller("/api/v1.2.2")
public class PaymentController {

    @DoGet("/get-something")
    public void getSomeThing() {}

    @DoGet("/get-and-buy-something")
    public void getAndBuySomeThing() {}
}

9. EzyProperty

When you want to map a property value or system property value or system environment value to a field or setter method, you can use EzyProperty annotation like this:
@Setter
public class GameProperty {

    @EzyProperty("game.max_room")
    private int maxRoom;
    
    @EzyProperty("game.max_player")
    private int maxPlayers;
}