Class PropertyImpl
- java.lang.Object
-
- org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
-
- org.apache.xmlbeans.impl.jam.internal.elements.AnnotatedElementImpl
-
- org.apache.xmlbeans.impl.jam.internal.elements.PropertyImpl
-
- All Implemented Interfaces:
java.lang.Comparable
,JAnnotatedElement
,JElement
,JProperty
,MAnnotatedElement
,MElement
public class PropertyImpl extends AnnotatedElementImpl implements JProperty
Implementation of JProperty.
-
-
Field Summary
-
Fields inherited from class org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
NO_ANNOTATION, NO_CLASS, NO_COMMENT, NO_CONSTRUCTOR, NO_FIELD, NO_METHOD, NO_NODE, NO_PACKAGE, NO_PARAMETER, NO_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description PropertyImpl(java.lang.String name, JMethod getter, JMethod setter, java.lang.String qualifiedTypeName)
You'll usually want to use the getProperties() factory method instead of constructing JProperties yourself.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(JVisitor visitor)
Accepts the given visitor.void
accept(MVisitor visitor)
JAnnotation
getAnnotation(java.lang.String named)
Returns the first annotation with the given name that is found on this property's getter and/or setters.JAnnotation[]
getAnnotations()
Returns all of the annotations on the getter and/or the setter methods.JComment
getComment()
Returns the comment associated with this abstraction.JMethod
getGetter()
Returns a JMethod which represents the getter for this property.java.lang.String
getQualifiedName()
Returns the simple name of this property.JMethod
getSetter()
Returns a JMethod which represents the setter for this property.java.lang.String
getSimpleName()
Returns the simple name of this property.JSourcePosition
getSourcePosition()
Returns an object describing the source file position of this elements, or null if the position is unknown on not applicable.JClass
getType()
Returns a JClass which represents the type of this property.void
setGetter(JMethod method)
void
setSetter(JMethod method)
Returns annotations with the given name that are found on this property's getter and/or setter.java.lang.String
toString()
Returns the same String as getQualifiedName().-
Methods inherited from class org.apache.xmlbeans.impl.jam.internal.elements.AnnotatedElementImpl
addAnnotationForProxy, addLiteralAnnotation, createComment, findOrCreateAnnotation, getAllJavadocTags, getAnnotation, getAnnotationProxy, getAnnotationValue, getEditableProxy, getMutableAnnotation, getMutableAnnotations, getMutableComment, removeAnnotation, removeComment
-
Methods inherited from class org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
compareTo, createSourcePosition, defaultName, equals, getArtifact, getClassLoader, getContext, getMutableSourcePosition, getParent, hashCode, removeSourcePosition, setArtifact, setSimpleName
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JAnnotatedElement
getAllJavadocTags, getAnnotation, getAnnotationProxy, getAnnotationValue
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JElement
getArtifact, getParent
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.mutable.MElement
createSourcePosition, getClassLoader, getMutableSourcePosition, removeSourcePosition, setArtifact, setSimpleName
-
-
-
-
Constructor Detail
-
PropertyImpl
public PropertyImpl(java.lang.String name, JMethod getter, JMethod setter, java.lang.String qualifiedTypeName)
You'll usually want to use the getProperties() factory method instead of constructing JProperties yourself. This constructor is exposed just in case the default rules in the factory method for identifying properties are insufficient for some use case.
-
-
Method Detail
-
getType
public JClass getType()
Returns a JClass which represents the type of this property.
-
getSimpleName
public java.lang.String getSimpleName()
Returns the simple name of this property. For example, for a property manifest by getFoo() and setFoo(), this will return 'foo'.- Specified by:
getSimpleName
in interfaceJElement
- Overrides:
getSimpleName
in classElementImpl
-
getQualifiedName
public java.lang.String getQualifiedName()
Returns the simple name of this property. For example, for a property manifest by getFoo() and setFoo(), this will return 'foo'.- Specified by:
getQualifiedName
in interfaceJElement
-
getSetter
public JMethod getSetter()
Returns a JMethod which represents the setter for this property. Returns null if this property is view-only.
-
getGetter
public JMethod getGetter()
Returns a JMethod which represents the getter for this property. Returns null if this property is write-only.
-
getAnnotations
public JAnnotation[] getAnnotations()
Returns all of the annotations on the getter and/or the setter methods.- Specified by:
getAnnotations
in interfaceJAnnotatedElement
- Overrides:
getAnnotations
in classAnnotatedElementImpl
-
setSetter
public void setSetter(JMethod method)
Returns annotations with the given name that are found on this property's getter and/or setter. public JAnnotation[] getAnnotations(String named) { return combine((mGetter == null) ? BaseJElement.NO_ANNOTATION : mGetter.getAnnotations(named), (mSetter == null) ? BaseJElement.NO_ANNOTATION : mSetter.getAnnotations(named)); }
-
setGetter
public void setGetter(JMethod method)
-
getAnnotation
public JAnnotation getAnnotation(java.lang.String named)
Returns the first annotation with the given name that is found on this property's getter and/or setters.- Specified by:
getAnnotation
in interfaceJAnnotatedElement
- Overrides:
getAnnotation
in classAnnotatedElementImpl
-
getComment
public JComment getComment()
Description copied from interface:JAnnotatedElement
Returns the comment associated with this abstraction. Returns null if it has no comment.
- Specified by:
getComment
in interfaceJAnnotatedElement
- Overrides:
getComment
in classAnnotatedElementImpl
-
getSourcePosition
public JSourcePosition getSourcePosition()
Description copied from interface:JElement
Returns an object describing the source file position of this elements, or null if the position is unknown on not applicable.- Specified by:
getSourcePosition
in interfaceJElement
- Overrides:
getSourcePosition
in classElementImpl
-
accept
public void accept(JVisitor visitor)
Description copied from interface:JElement
Accepts the given visitor.
-
toString
public java.lang.String toString()
Description copied from interface:JElement
Returns the same String as getQualifiedName().
- Specified by:
toString
in interfaceJElement
- Overrides:
toString
in classElementImpl
-
-