net.sf.jelly.apt.decorations.declaration
Class PropertyDeclaration

java.lang.Object
  extended by net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration
      extended by net.sf.jelly.apt.decorations.declaration.DecoratedMemberDeclaration
          extended by net.sf.jelly.apt.decorations.declaration.DecoratedExecutableDeclaration
              extended by net.sf.jelly.apt.decorations.declaration.DecoratedMethodDeclaration
                  extended by net.sf.jelly.apt.decorations.declaration.PropertyDeclaration
All Implemented Interfaces:
com.sun.mirror.declaration.Declaration, com.sun.mirror.declaration.ExecutableDeclaration, com.sun.mirror.declaration.MemberDeclaration, com.sun.mirror.declaration.MethodDeclaration

public class PropertyDeclaration
extends DecoratedMethodDeclaration

A property, representing the getter/setter pair. In all cases, the description of the property matches the description of the getter, but the annotations are the union of the getter and the setter, with the intersection preferring the getter.

Author:
Ryan Heaton

Field Summary
 
Fields inherited from class net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration
delegate, javaDoc
 
Constructor Summary
PropertyDeclaration(DecoratedMethodDeclaration getter, DecoratedMethodDeclaration setter)
          A property declaration.
 
Method Summary
<A extends java.lang.annotation.Annotation>
A
getAnnotation(java.lang.Class<A> annotationType)
          Gets the annotation on the getter.
 java.util.Collection<com.sun.mirror.declaration.AnnotationMirror> getAnnotationMirrors()
          Gets the collection of annotations on the setter and the getter.
 java.util.Map<java.lang.String,com.sun.mirror.declaration.AnnotationMirror> getAnnotations()
          Gets the annotations on the setter and the getter.
 DecoratedMethodDeclaration getGetter()
          The getter.
 java.lang.String getPropertyName()
          Make sure the property name is calculated correctly.
 com.sun.mirror.type.TypeMirror getPropertyType()
          The type of this property.
 DecoratedMethodDeclaration getSetter()
          The setter, or null if this property is a read-only property.
 java.lang.String getSimpleName()
          The simple name of the property is the property name.
 boolean isReadOnly()
          Whether this property is read-only.
 
Methods inherited from class net.sf.jelly.apt.decorations.declaration.DecoratedMethodDeclaration
accept, getReturnType, isGetter, isSetter
 
Methods inherited from class net.sf.jelly.apt.decorations.declaration.DecoratedExecutableDeclaration
getFormalTypeParameters, getParameters, getThrownTypes, isVarArgs
 
Methods inherited from class net.sf.jelly.apt.decorations.declaration.DecoratedMemberDeclaration
getDeclaringType
 
Methods inherited from class net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration
equals, getDelegate, getDocComment, getJavaDoc, getModifiers, getPosition, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.mirror.declaration.ExecutableDeclaration
getFormalTypeParameters, getParameters, getThrownTypes, isVarArgs
 
Methods inherited from interface com.sun.mirror.declaration.MemberDeclaration
getDeclaringType
 
Methods inherited from interface com.sun.mirror.declaration.Declaration
equals, getDocComment, getModifiers, getPosition
 

Constructor Detail

PropertyDeclaration

public PropertyDeclaration(DecoratedMethodDeclaration getter,
                           DecoratedMethodDeclaration setter)
A property declaration.

Parameters:
getter - The getter.
setter - The setter.
Throws:
java.lang.IllegalStateException - If the getter and setter don't pair up.
Method Detail

getPropertyType

public com.sun.mirror.type.TypeMirror getPropertyType()
The type of this property.

Returns:
The type of this property.

getSimpleName

public java.lang.String getSimpleName()
The simple name of the property is the property name.

Specified by:
getSimpleName in interface com.sun.mirror.declaration.Declaration
Overrides:
getSimpleName in class DecoratedDeclaration
Returns:
The simple name of the property is the property name.

getPropertyName

public java.lang.String getPropertyName()
Make sure the property name is calculated correctly. cd

Overrides:
getPropertyName in class DecoratedMethodDeclaration

getSetter

public DecoratedMethodDeclaration getSetter()
The setter, or null if this property is a read-only property.

Returns:
The setter.

getGetter

public DecoratedMethodDeclaration getGetter()
The getter.

Returns:
The getter.

isReadOnly

public boolean isReadOnly()
Whether this property is read-only.

Returns:
Whether this property is read-only.

getAnnotations

public java.util.Map<java.lang.String,com.sun.mirror.declaration.AnnotationMirror> getAnnotations()
Gets the annotations on the setter and the getter. If the annotation is on both the setter and the getter, only the one on the getter will be included.

Overrides:
getAnnotations in class DecoratedDeclaration
Returns:
The union of the annotations on the getter and setter.

getAnnotationMirrors

public java.util.Collection<com.sun.mirror.declaration.AnnotationMirror> getAnnotationMirrors()
Gets the collection of annotations on the setter and the getter. If the annotation is on both the setter and the getter, only the one on the getter will be included.

Specified by:
getAnnotationMirrors in interface com.sun.mirror.declaration.Declaration
Overrides:
getAnnotationMirrors in class DecoratedDeclaration
Returns:
The union of the annotations on the getter and setter.

getAnnotation

public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> annotationType)
Gets the annotation on the getter. If it doesn't exist, returns the one on the setter.

Specified by:
getAnnotation in interface com.sun.mirror.declaration.Declaration
Overrides:
getAnnotation in class DecoratedDeclaration
Parameters:
annotationType - The annotation type.
Returns:
The annotation.