Package jodd.introspector
Class PropertyDescriptor
- java.lang.Object
-
- jodd.introspector.Descriptor
-
- jodd.introspector.PropertyDescriptor
-
public class PropertyDescriptor extends Descriptor
Property descriptor. It consist of read, write and field descriptor. Only one of those three descriptors may exist.
-
-
Field Summary
Fields Modifier and Type Field Description protected FieldDescriptorfieldDescriptorprotected Getter[]gettersprotected java.lang.Stringnameprotected MethodDescriptorreadMethodDescriptorprotected Setter[]settersprotected java.lang.Classtypeprotected MethodDescriptorwriteMethodDescriptor-
Fields inherited from class jodd.introspector.Descriptor
classDescriptor, isPublic
-
-
Constructor Summary
Constructors Constructor Description PropertyDescriptor(ClassDescriptor classDescriptor, java.lang.String propertyName, FieldDescriptor fieldDescriptor)Creates field-only property descriptor.PropertyDescriptor(ClassDescriptor classDescriptor, java.lang.String propertyName, MethodDescriptor readMethod, MethodDescriptor writeMethod)Creates property descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GettercreateGetter(boolean declared)Creates aGetter.protected SettercreateSetter(boolean declared)Creates aSetter.protected FieldDescriptorfindField(java.lang.String fieldName)Locates property field.FieldDescriptorgetFieldDescriptor()Returns the associated field of this property.GettergetGetter(boolean declared)ReturnsGetter.java.lang.StringgetName()Returns property name.MethodDescriptorgetReadMethodDescriptor()Returns read method of this property.SettergetSetter(boolean declared)ReturnsSetter.java.lang.ClassgetType()Returns property type.MethodDescriptorgetWriteMethodDescriptor()Returns write method of this property.booleanisFieldOnly()Returnstrueif this is an extended property with only field definition and without getter and setter.booleanisGetterOnly()Returnstrueif this property has only a getter method.booleanisSetterOnly()Returnstrueif this property has only a setter method.java.lang.ClassresolveComponentType(boolean declared)Resolves component type for given property descriptor.java.lang.ClassresolveKeyType(boolean declared)Resolves key type for given property descriptor.-
Methods inherited from class jodd.introspector.Descriptor
getClassDescriptor, isPublic, matchDeclared
-
-
-
-
Field Detail
-
name
protected final java.lang.String name
-
readMethodDescriptor
protected final MethodDescriptor readMethodDescriptor
-
writeMethodDescriptor
protected final MethodDescriptor writeMethodDescriptor
-
fieldDescriptor
protected final FieldDescriptor fieldDescriptor
-
type
protected java.lang.Class type
-
getters
protected Getter[] getters
-
setters
protected Setter[] setters
-
-
Constructor Detail
-
PropertyDescriptor
public PropertyDescriptor(ClassDescriptor classDescriptor, java.lang.String propertyName, FieldDescriptor fieldDescriptor)
Creates field-only property descriptor.
-
PropertyDescriptor
public PropertyDescriptor(ClassDescriptor classDescriptor, java.lang.String propertyName, MethodDescriptor readMethod, MethodDescriptor writeMethod)
Creates property descriptor.
-
-
Method Detail
-
findField
protected FieldDescriptor findField(java.lang.String fieldName)
Locates property field. Field is being searched also in all superclasses of current class.
-
getName
public java.lang.String getName()
Returns property name.- Specified by:
getNamein classDescriptor
-
getReadMethodDescriptor
public MethodDescriptor getReadMethodDescriptor()
Returns read method of this property. May benullif read method is not defined.
-
getWriteMethodDescriptor
public MethodDescriptor getWriteMethodDescriptor()
Returns write method of this property. May benullfor read-only properties.
-
getFieldDescriptor
public FieldDescriptor getFieldDescriptor()
Returns the associated field of this property. May benullif properties are not enhanced by field description.
-
isFieldOnly
public boolean isFieldOnly()
Returnstrueif this is an extended property with only field definition and without getter and setter.
-
isGetterOnly
public boolean isGetterOnly()
Returnstrueif this property has only a getter method.
-
isSetterOnly
public boolean isSetterOnly()
Returnstrueif this property has only a setter method.
-
getType
public java.lang.Class getType()
Returns property type. Raw types are detected.
-
getGetter
public Getter getGetter(boolean declared)
ReturnsGetter. May returnnullif no matched getter is found.
-
getSetter
public Setter getSetter(boolean declared)
ReturnsSetter. May returnnullif no matched setter is found.
-
resolveKeyType
public java.lang.Class resolveKeyType(boolean declared)
Resolves key type for given property descriptor.
-
resolveComponentType
public java.lang.Class resolveComponentType(boolean declared)
Resolves component type for given property descriptor.
-
-