|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.spicefactory.lib.reflect.Property
public class Property
Represents a single Property of a Bean. Provides information on the type of the Property (correctly dealing with generics in contrast to the Introspector in Java SE 5/6 which is basically broken for generic properties). It also provides methods for reading and writing property values including any necessary type conversion (as long as a matching Converter instance was registered in the ReflectionFactory). Property instances must be obtained through Bean instances (which in turn must be obtained through ReflectionFactory instances).
| Method Summary | ||
|---|---|---|
Object |
convert(Object value)
Converts the specified value to the target type of this Property if possible. |
|
|
getAnnotation(Class<A> annotationClass)
Returns the Annotation for the specified type if present on the getter or setter method of this property, otherwise null. |
|
Annotation[] |
getAnnotations()
Returns all Annotations present on either the getter or setter method of this Property. |
|
Bean |
getBean()
Deprecated. |
|
Type |
getGenericType()
Returns the resolved generic type of this property. |
|
String |
getName()
The name of the property according to Java Bean conventions. |
|
Bean |
getOwnerBean()
Returns the owner Bean instance this Property belongs to. |
|
Class<?> |
getRawType()
The resolved raw type of this property. |
|
Bean |
getTypeAsBean()
The type of this property as a Bean instance. |
|
Object |
getValue(Object bean)
Returns the value of this property in the given bean instance. |
|
boolean |
isAnnotationPresent(Class<? extends Annotation> annotationClass)
Returns true if an annotation for the specified type is present on either the getter or setter method of this Property (or both). |
|
boolean |
isReadable()
Checks if this property is readable. |
|
boolean |
isWritable()
Checks if this property is writable. |
|
void |
setValue(Object bean,
Object value)
Set the value of this property on the given bean instance. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public String getName()
@Deprecated public Bean getBean()
getTypeAsBean,
use getOwnerBean instead.
public Bean getOwnerBean()
public Type getGenericType()
public Class<?> getRawType()
public Bean getTypeAsBean()
public boolean isReadable()
public boolean isWritable()
public <A extends Annotation> A getAnnotation(Class<A> annotationClass)
annotationClass - the Annotation type to look for
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
annotationClass - the Annotation type to look for
public Annotation[] getAnnotations()
public Object getValue(Object bean)
throws PropertyException
bean - the bean from which the property value should be read
PropertyException - if this property is write-only or if the getter threw an Exception
public void setValue(Object bean,
Object value)
throws PropertyException
bean - the bean on which the property value should be setvalue - the new value of the property
PropertyException - if this property is read-only, type conversion failed or the setter method
threw an Exception
public Object convert(Object value)
throws ConversionException
setValue. This Property must not be read-only, in this case
an Excpetion will be thrown.
value - the value to convert to the target type of this Property
ConversionException - if the conversion failspublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||