Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "JAXWS/Tools Extension Points"
m (JAX-WS Tools Extension Points moved to JAXWS/Tools Extension Points: Reorganizing names) |
|||
Line 35: | Line 35: | ||
class="javax.jws.WebService" | class="javax.jws.WebService" | ||
name="WebService"> | name="WebService"> | ||
+ | </annotation> | ||
+ | </extension> | ||
+ | </source> | ||
+ | |||
+ | '''Example:''' Annotations use [http://java.sun.com/j2se/1.5.0/docs/api/java/lang/annotation/ElementType.html ElementType] constants with the [http://java.sun.com/j2se/1.5.0/docs/api/java/lang/annotation/Target.html Target] meta-annotation type to specify where the annotation can be applied. This information is used by the JAX-WS Annotation Properties view when presenting applicable annotations for a selected element in the Java editor. One of those constants is the [http://java.sun.com/j2se/1.5.0/docs/api/java/lang/annotation/ElementType.html#TYPE ElementType.TYPE] constant which covers classes, interfaces and enum declarations. It's possible to further refine that restriction in the properties view using the optional ''restrictedTo'' attribute when defining the annotation. | ||
+ | <source lang="xml"> | ||
+ | <extension point="org.eclipse.jst.ws.annotations.core.annotationDefinition"> | ||
+ | <annotation | ||
+ | category="jaxws.category" | ||
+ | class="javax.xml.ws.WebServiceProvider" | ||
+ | name="WebServiceProvider" | ||
+ | restrictedTo="CLASS_ONLY"> | ||
+ | </annotation> | ||
+ | </extension> | ||
+ | </source> | ||
+ | |||
+ | '''Example:''' The @HandlerChain annotation specifies the TYPE, METHOD and FIELD [http://java.sun.com/j2se/1.5.0/docs/api/java/lang/annotation/ElementType.html ElementType] as its applicable targets. However in JAX-WS 2.1 the @HandlerChain annotation may only be specified on a TYPE. The METHOD and FIELD element types were used in JAX-WS 2.0. To filter out the METHOD and FIELD element types so that the @HandlerChain annotation isn't presented for those selections in the JAX-WS Annotation Properties view we can use the ''targetFilter'' attribute when defining the annotation. | ||
+ | <source lang="xml"> | ||
+ | <extension point="org.eclipse.jst.ws.annotations.core.annotationDefinition"> | ||
+ | <annotation | ||
+ | category="jaxws.category" | ||
+ | class="javax.jws.HandlerChain" | ||
+ | name="HandlerChain"> | ||
+ | <targetFilter target="FIELD"/> | ||
+ | <targetFilter target="METHOD"/> | ||
</annotation> | </annotation> | ||
</extension> | </extension> |
Revision as of 18:30, 26 September 2009
Contents
Annotations Framework
Annotation Category
Plug-in: org.eclipse.jst.ws.annotations.core
Identifier: org.eclipse.jst.ws.annotations.core.annotationCategory
Description: The purpose of this extension point is to define an annotation category to group together a set of annotations.
Consumers org.eclipse.jst.ws.jaxws.core, org.eclipse.jst.ws.jaxb.core
Example: Defines a JAX-WS category.
<extension point="org.eclipse.jst.ws.annotations.core.annotationCategory"> <category id="jaxws.category" name="JAX-WS"> </category> </extension>
Annotation Definition
Plug-in: org.eclipse.jst.ws.annotations.core
Identifier: org.eclipse.jst.ws.annotations.core.annotationDefinition
Description: This extension point is is used to define an annotation.
Consumers org.eclipse.jst.ws.jaxws.core, org.eclipse.jst.ws.jaxb.core
Example: Defines the javax.jws.WebService annotation.
<extension point="org.eclipse.jst.ws.annotations.core.annotationDefinition"> <annotation category="jaxws.category" class="javax.jws.WebService" name="WebService"> </annotation> </extension>
Example: Annotations use ElementType constants with the Target meta-annotation type to specify where the annotation can be applied. This information is used by the JAX-WS Annotation Properties view when presenting applicable annotations for a selected element in the Java editor. One of those constants is the ElementType.TYPE constant which covers classes, interfaces and enum declarations. It's possible to further refine that restriction in the properties view using the optional restrictedTo attribute when defining the annotation.
<extension point="org.eclipse.jst.ws.annotations.core.annotationDefinition"> <annotation category="jaxws.category" class="javax.xml.ws.WebServiceProvider" name="WebServiceProvider" restrictedTo="CLASS_ONLY"> </annotation> </extension>
Example: The @HandlerChain annotation specifies the TYPE, METHOD and FIELD ElementType as its applicable targets. However in JAX-WS 2.1 the @HandlerChain annotation may only be specified on a TYPE. The METHOD and FIELD element types were used in JAX-WS 2.0. To filter out the METHOD and FIELD element types so that the @HandlerChain annotation isn't presented for those selections in the JAX-WS Annotation Properties view we can use the targetFilter attribute when defining the annotation.
<extension point="org.eclipse.jst.ws.annotations.core.annotationDefinition"> <annotation category="jaxws.category" class="javax.jws.HandlerChain" name="HandlerChain"> <targetFilter target="FIELD"/> <targetFilter target="METHOD"/> </annotation> </extension>
Annotation Initializer
Plug-in: org.eclipse.jst.ws.annotations.core
Identifier: org.eclipse.jst.ws.annotations.core.annotationInitializer
Description: This extension point is used to define an 'initializer' for an annotation which can used to calculate values for the annotations elements.
Consumers org.eclipse.jst.ws.jaxws.ui
Example: Adds an initializer for the javax.jws.WebService annotation.
<extension point="org.eclipse.jst.ws.annotations.core.annotationInitializer"> <initializer annotation="javax.jws.WebService" class="org.eclipse.jst.ws.internal.jaxws.ui.annotations.initialization.WebServiceAttributeInitializer"> </initializer> </extension>
Annotation Processor
Plug-in: org.eclipse.jst.ws.annotations.core
Identifier: org.eclipse.jst.ws.annotations.core.annotationProcessor
Description: This extension point is used to define a APT 'processor' which is used to validate the annotation.
Consumers org.eclipse.jst.ws.jaxws.core
Example: Adds a processor to validate a subset of the rules pertaining to the javax.jws.WebService annotation.
<extension point="org.eclipse.jst.ws.annotations.core.annotationProcessor"> <processor annotation="javax.jws.WebService" class="org.eclipse.jst.ws.internal.jaxws.core.annotations.validation.WebServicePublicAbstractFinalRule"> <description> Classes annotated with @WebService must be an outer public class, must not be final, and must not be abstract </description> </processor> </extension>