|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.odata4j.producer.inmemory.BeanModel
public class BeanModel
An abstract representation of the "bean" nature of a class. This class caches up-front analysis of a class to locate the getters and setters it will need in order to operate on instances.
Instances of this class can then be used in place of reflection.
Constructor Summary | |
---|---|
BeanModel(Class<?> beanClass)
Constructs the abstract bean representation of a class. |
|
BeanModel(Class<?> beanClass,
boolean flatten)
Constructs the abstract bean representation of a class. |
Method Summary | ||
---|---|---|
boolean |
canRead(String propertyName)
Returns true if the property has a getter. |
|
boolean |
canWrite(String propertyName)
Returns true if the property has a setter. |
|
Class<?> |
getBeanClass()
Recovers the original class on which this metadata is based. |
|
Class<?> |
getCollectionElementType(String collectionName)
For any given collection type, identifies the type of the elements of the collection. |
|
Iterable<String> |
getCollectionNames()
Returns the list of properties that have collection types. |
|
Iterable<?> |
getCollectionValue(Object target,
String collectionName)
Returns a collection from a property in an instance. |
|
Iterable<String> |
getDeclaredCollectionNames()
Get the collection names that were defined in this.beanClass only (i.e. |
|
Iterable<String> |
getDeclaredPropertyNames()
Get the property names that were defined in this.beanClass only (i.e. |
|
Iterable<String> |
getPropertyNames()
Returns the list of all properties identified on this class. |
|
Class<?> |
getPropertyType(String propertyName)
Discovers the type of a property. |
|
Object |
getPropertyValue(Object target,
String propertyName)
Interrogates an instance of the target class and discovers the value of a given property. |
|
BeanModel |
getSuperClassModel()
Returns the BeanModel for the superclass of this.beanClass |
|
|
setCollectionValue(Object target,
String collectionName,
Collection<T> collectionValue)
Updates a collection property. |
|
void |
setPropertyValue(Object target,
String propertyName,
Object propertyValue)
Updates an instance to set a property to a given value This method is only intended to be used for simple properties |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BeanModel(Class<?> beanClass)
beanClass
- the class to introspectpublic BeanModel(Class<?> beanClass, boolean flatten)
beanClass
- the class to introspectflatten
- flatten inheritance or not (@see BeanBasePropertyModel)Method Detail |
---|
public boolean canRead(String propertyName)
public boolean canWrite(String propertyName)
public Class<?> getBeanClass()
public Class<?> getCollectionElementType(String collectionName)
collectionName
- the name of the collection
public Iterable<String> getCollectionNames()
public Iterable<?> getCollectionValue(Object target, String collectionName)
target
- the instance to look atcollectionName
- the name of the property on the instance which holds the collection
public Iterable<String> getDeclaredCollectionNames()
public Iterable<String> getDeclaredPropertyNames()
public Iterable<String> getPropertyNames()
A property is any field that has a simple value type (i.e. not a collection type) and either has a getter or a setter defined on it.
public Class<?> getPropertyType(String propertyName)
propertyName
- the property you are interested in
public Object getPropertyValue(Object target, String propertyName)
target
- the instance of the classpropertyName
- the name of the property to fetch
public BeanModel getSuperClassModel()
public <T> void setCollectionValue(Object target, String collectionName, Collection<T> collectionValue)
target
- the instance to look atcollectionName
- the name of the property on the instance which holds the collectioncollectionValue
- the new collectionpublic void setPropertyValue(Object target, String propertyName, Object propertyValue)
target
- the instance to updatepropertyName
- the name of the propertypropertyValue
- the value to set in the property
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |