Apache Tapestry Annotation - Apache Tapestry

What is Apache Tapestry Annotation?

Annotation is a very important feature exploited by Tapestry for simplifying the Web Application Development. Tapestry provides a lot of custom Annotations for Classes, Methods and Member Fields. Annotation can also be used to override default convention of a feature. Tapestry annotations are grouped into four main categories.

Why Component Annotation is useful?

Component Annotation is used in Pages, Components and Mixins Classes. Some of the suitable annotations are

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

Why IoC annotation is useful?

IoC annotation is used to inject objects into IoC Container and some of the useful annotations are

  • @Inject − @Inject is applicable to fields and is used to mark parameters that should be injected into the IoC container and fields that should be injected into components.
  • @Value − @Value is applicable to fields and is used with @inject annotation to inject a literal value instead of a service (is default behavior of @Inject annotation).

What are the uses of Annotation for Data Holding Classes?

It is used to identify component specific information in a class (usually models or data holding classes) for high level components such as

  • Grid (used for creating advanced tabular data such as report, gallery, etc.,)
  • BeanEditForm (Used for creating advanced forms)
  • Hibernate (Used in advanced database access), etc.

These Annotations are combined and packed into a separate jar without any tapestry dependency. Some of the annotations are

  • @DataType − 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 − used to specify validation rule for a field.

These separations enable Tapestry Application to use a Multi-Tier Design.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Apache Tapestry Topics