Dali Provisional API
Release 3.2

org.eclipse.jpt.common.core
Class GenericAnnotationProvider

java.lang.Object
  extended by org.eclipse.jpt.common.core.GenericAnnotationProvider
All Implemented Interfaces:
AnnotationProvider

public final class GenericAnnotationProvider
extends Object
implements AnnotationProvider

Implementation of AnnotationProvider that is constructed with an array of AnnotationDefinitions and NestableAnnotationDefinitions An AnnotationDefinition is needed if the annotation is only a stand-alone top-level annotation A NestableAnnotationDeifnition is needed if the annotation can be either stand-alone or nested within a container annotation. A *Definition is not needed if the annotation is only ever nested within another annotation.

See Also:
JavaResourceAnnotatedElement, AnnotationDefinition, Delegate to annotation definition providers. The platform factory will build an instance of this annotation provider, passing in the appropriate array of annotation definition providers necessary to build the annotations for the platform (vendor and/or version).

Constructor Summary
GenericAnnotationProvider(AnnotationDefinition[] annotationDefinitions, NestableAnnotationDefinition[] nestableAnnotationDefinitions)
           
 
Method Summary
 Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, String annotationName)
          Build an annotation with the specified name.
 NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, String annotationName, int index)
          Build a nestable annotation with the specified name and index.
 Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation)
          Build an annotation for the specified JDT annotation.
 NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index)
          Build a nestable annotation for the specified JDT annotation and index.
 Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent, String annotationName)
          Build a null annotation with the specified name.
protected  AnnotationDefinition getAnnotationDefinition(String annotationName)
           
protected  Iterable<AnnotationDefinition> getAnnotationDefinitions()
           
 Iterable<String> getAnnotationNames()
          Return the names of the annotations.
 String getContainerAnnotationName(String nestableAnnotationName)
          Return the "container" annotation name for the given "nestable" annotation name.
 Iterable<String> getContainerAnnotationNames()
          Return all the supported "container" annotation names.
protected  NestableAnnotationDefinition getNestableAnnotationDefinition(String annotationName)
           
protected  Iterable<NestableAnnotationDefinition> getNestableAnnotationDefinitions()
           
 String getNestableAnnotationName(String containerAnnotationName)
          Return the "nestable" annotation name for the given "container" annotation name.
 Iterable<String> getNestableAnnotationNames()
          Return all the supported "nestable" annotation names.
 String getNestableElementName(String nestableAnnotationName)
          Return the annotation "element" name used for the "nestable" annotation when it is nested within a "container" annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericAnnotationProvider

public GenericAnnotationProvider(AnnotationDefinition[] annotationDefinitions,
                                 NestableAnnotationDefinition[] nestableAnnotationDefinitions)
Method Detail

getAnnotationDefinitions

protected Iterable<AnnotationDefinition> getAnnotationDefinitions()

getAnnotationDefinition

protected AnnotationDefinition getAnnotationDefinition(String annotationName)

getAnnotationNames

public Iterable<String> getAnnotationNames()
Description copied from interface: AnnotationProvider
Return the names of the annotations.

Specified by:
getAnnotationNames in interface AnnotationProvider

getContainerAnnotationNames

public Iterable<String> getContainerAnnotationNames()
Description copied from interface: AnnotationProvider
Return all the supported "container" annotation names. These are defined via the list of NestableAnnotationDefinitions. A NestableAnnotationDefinition defines its corresponding "container" annotation name. You must also provide an AnnotationDefinition for the "container" annotation.

Specified by:
getContainerAnnotationNames in interface AnnotationProvider
See Also:
NestableAnnotationDefinition.getContainerAnnotationName()

getNestableAnnotationNames

public Iterable<String> getNestableAnnotationNames()
Description copied from interface: AnnotationProvider
Return all the supported "nestable" annotation names. These are defined via the list of NestableAnnotationDefinitions.

Specified by:
getNestableAnnotationNames in interface AnnotationProvider
See Also:
NestableAnnotationDefinition.getNestableAnnotationName()

buildAnnotation

public Annotation buildAnnotation(JavaResourceAnnotatedElement parent,
                                  AnnotatedElement element,
                                  String annotationName)
Description copied from interface: AnnotationProvider
Build an annotation with the specified name. Throw an IllegalArgumentException if the specified name is unsupported.

Specified by:
buildAnnotation in interface AnnotationProvider
See Also:
AnnotationProvider.getAnnotationNames()

buildAnnotation

public Annotation buildAnnotation(JavaResourceAnnotatedElement parent,
                                  IAnnotation jdtAnnotation)
Description copied from interface: AnnotationProvider
Build an annotation for the specified JDT annotation. Throw an IllegalArgumentException if the specified annotation is unsupported.

Specified by:
buildAnnotation in interface AnnotationProvider
See Also:
AnnotationProvider.getAnnotationNames()

buildAnnotation

public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent,
                                          IAnnotation jdtAnnotation,
                                          int index)
Description copied from interface: AnnotationProvider
Build a nestable annotation for the specified JDT annotation and index. Throw an IllegalArgumentException if the specified annotation is unsupported.

Specified by:
buildAnnotation in interface AnnotationProvider
See Also:
AnnotationProvider.getNestableAnnotationNames()

buildNullAnnotation

public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent,
                                      String annotationName)
Description copied from interface: AnnotationProvider
Build a null annotation with the specified name. Throw an IllegalArgumentException if the specified annotation is unsupported.

Specified by:
buildNullAnnotation in interface AnnotationProvider
See Also:
AnnotationProvider.getAnnotationNames()

getNestableAnnotationDefinitions

protected Iterable<NestableAnnotationDefinition> getNestableAnnotationDefinitions()

getNestableAnnotationDefinition

protected NestableAnnotationDefinition getNestableAnnotationDefinition(String annotationName)

buildAnnotation

public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent,
                                          AnnotatedElement element,
                                          String annotationName,
                                          int index)
Description copied from interface: AnnotationProvider
Build a nestable annotation with the specified name and index. Throw an IllegalArgumentException if the specified name is unsupported.

Specified by:
buildAnnotation in interface AnnotationProvider
See Also:
AnnotationProvider.getNestableAnnotationNames()

getNestableAnnotationName

public String getNestableAnnotationName(String containerAnnotationName)
Description copied from interface: AnnotationProvider
Return the "nestable" annotation name for the given "container" annotation name.

Specified by:
getNestableAnnotationName in interface AnnotationProvider
See Also:
NestableAnnotationDefinition

getContainerAnnotationName

public String getContainerAnnotationName(String nestableAnnotationName)
Description copied from interface: AnnotationProvider
Return the "container" annotation name for the given "nestable" annotation name.

Specified by:
getContainerAnnotationName in interface AnnotationProvider
See Also:
NestableAnnotationDefinition

getNestableElementName

public String getNestableElementName(String nestableAnnotationName)
Description copied from interface: AnnotationProvider
Return the annotation "element" name used for the "nestable" annotation when it is nested within a "container" annotation. Typically "value".

Specified by:
getNestableElementName in interface AnnotationProvider
See Also:
NestableAnnotationDefinition.getElementName()

Dali Provisional API
Release 3.2

Copyright (c) 2012 Oracle. All rights reserved.