public class ReflectUtils extends Object
Constructor and Description |
---|
ReflectUtils() |
Modifier and Type | Method and Description |
---|---|
static Class<?> |
getEntryClass(Feed feed)
Returns the Java class of a set of entries contained inside a Feed.
|
static Class<?> |
getSimpleClass(Object entity,
String propertyName)
Returns the class of this entity's attribute, or if it is a Collection
(array, generic list, set), it returns the generic type.
|
static Object |
invokeGetter(Object entity,
String propertyName)
Returns the value of a property on an entity based on its name.
|
static void |
invokeSetter(Object entity,
String propertyName,
Object propertyValue)
Sets a property on an entity based on its name.
|
static void |
invokeSetter(Object entity,
String propertyName,
String propertyValue,
String propertyType)
Sets a property on an entity based on its name.
|
static boolean |
isReservedWord(String name)
Returns true if the given name is a Java reserved word.
|
static String |
normalize(String name)
Returns the name following the the java naming rules.
|
static void |
setProperty(Object entity,
Property property,
String propertyValue)
Sets a property on an entity based on its name.
|
static void |
setProperty(Object entity,
String propertyName,
boolean isCollection,
Iterator<?> iterator,
Class<?> propertyClass)
Sets a property on an entity based on its name.
|
static void |
setProperty(Object entity,
String propertyName,
String propertyValue)
Sets a property on an entity based on its name.
|
public static Class<?> getEntryClass(Feed feed)
feed
- The feed to analyze.public static Class<?> getSimpleClass(Object entity, String propertyName)
entity
- The entity.propertyName
- The property name.public static Object invokeGetter(Object entity, String propertyName) throws Exception
entity
- The entity.propertyName
- The property name.Exception
public static void invokeSetter(Object entity, String propertyName, Object propertyValue) throws Exception
entity
- The entity to update.propertyName
- The property name.propertyValue
- The property value.Exception
public static void invokeSetter(Object entity, String propertyName, String propertyValue, String propertyType) throws Exception
entity
- The entity to update.propertyName
- The property name.propertyValue
- The property value.propertyType
- The property data type.Exception
public static boolean isReservedWord(String name)
name
- The name to test.public static String normalize(String name)
name
- The name to convert.public static void setProperty(Object entity, Property property, String propertyValue) throws Exception
entity
- The entity to update.property
- The property.propertyValue
- The property value.Exception
public static void setProperty(Object entity, String propertyName, boolean isCollection, Iterator<?> iterator, Class<?> propertyClass) throws Exception
entity
- The entity to update.propertyName
- The property name.isCollection
- Should this property be a collection.iterator
- The collection of values to set.propertyClass
- The kind of objects stored by this property.Exception
Copyright © 2005–2013. All rights reserved.