পৃষ্ঠাসমূহ

.

Search Your Article

Total Pageviews

Sunday, February 12, 2017

Apache Tapestry - Annotation

Annotation is a very important feature exploited by Tapestry to simplify the Web Application Development. Tapestry provides a lot of custom Annotations. It has Annotation for Classes, Methods and Member Fields. As discussed in the previous section, Annotation may also be used to override default convention of a feature.
Tapestry annotations are grouped into four main categories and they are as follows.

Component Annotation

Used in Pages, Components and Mixins Classes. Some of the useful annotations are −
  • @Property − It is applicable to fields. Used to convert a field into a Tapestry Property.
  • @Parameter − It is applicable to fields. Used to specify a field as parameter of a component.
  • @Environmental − It is applicable to fields. Used to share a private field between different components.
  • @import − It is applicable to classes and fields. Used to include Assets, CSS and JavaScript.
  • @Path − Used in conjunction with the @Inject annotation to inject an Asset based on a path.
  • @Log − It is applicable to classes and fields. Used for debugging purposes. Can be used emit component's event information like start of the event, end of the event, etc.

IoC annotation

Used to inject objects into IoC Container. Some of the useful annotations are −
  • @Inject − It is applicable to fields. Used to mark parameters that should be injected into the IoC container. It marks fields that should be injected into components.
  • @Value − It is applicable to fields. Used along with @inject annotation to inject a literal value instead of a service (which is default behavior of @Inject annotation).

Annotation for Data Holding Classes

It is used to specify component specific information in a class (usually models or data holding classes) for high level components such as
  • Grid (used to create advanced tabular data such as report, gallery, etc.,)
  • BeanEditForm (Used to create advanced forms)
  • Hibernate (Used in advanced database access), etc.
These Annotations are aggregated and packaged into a separate jar without any tapestry dependency. Some of the annotations are −
  • @DataType − It is used to specify the data type of the field. Tapestry component may use this information to create design or markup in the presentation layer.
  • @Validate − It is used to specify the validation rule for a field.
These separations enable the Tapestry Application to use a Multi-Tier Design.

No comments:

Post a Comment