|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectatg.rest.util.BeanUtils
public class BeanUtils
A class which provides common utility methods.
| Field Summary | |
|---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
| Constructor Summary | |
|---|---|
BeanUtils()
|
|
| Method Summary | |
|---|---|
protected static java.util.Collection<?> |
convertCollectionType(java.lang.Class<?> pClass,
java.lang.Class<?> pComponentClass,
java.lang.String pValue,
boolean pUseStandardJSON,
JSONObject pControlParamsForJSON,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Converts the given string into an object of the specified Collection type. |
protected static java.util.Collection<?> |
convertCollectionType(java.lang.Class<?> pClass,
java.lang.String pValue,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Converts the given string into an object of the specified Collection type. |
static java.lang.Object |
convertDataToType(java.lang.Class<?> pClass,
java.lang.Class<?> pKeyClass,
java.lang.Class<?> pComponentClass,
java.lang.String pValue,
boolean pUseStandardJSON,
JSONObject pControlParamsForJSON,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method converts the given value to an object of the given Class type. |
static java.lang.Object |
convertDataToType(java.lang.Class<?> pClass,
java.lang.String pValue,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method converts the given value to an object of the given Class type. |
protected static java.util.Date |
convertDateTimeType(java.lang.Class<?> pClass,
java.lang.String pValue)
Converts the given string into an object of the specified "date" or "time" type. |
protected static java.util.Map<?,?> |
convertMapType(java.lang.Class<?> pClass,
java.lang.Class<?> pKeyClass,
java.lang.Class<?> pValueClass,
java.lang.String pValue,
boolean pUseStandardJSON,
JSONObject pControlParamsForJSON,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Converts the given string into an object of the specified Map type. |
protected static java.util.Map<?,?> |
convertMapType(java.lang.Class<?> pClass,
java.lang.String pValue,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Converts the given string into an object of the specified Map type. |
protected static java.lang.Object |
convertObjectArrayType(java.lang.Class<?> pClass,
java.lang.String pValue,
boolean pUseStandardJSON,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method converts the given value to an object of the given object array Class type. |
protected static java.lang.Object |
convertObjectArrayType(java.lang.Class<?> pClass,
java.lang.String pValue,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method converts the given value to an object of the given object array Class type. |
protected static java.lang.Object |
convertPrimitiveArrayType(java.lang.Class<?> pClass,
java.lang.String pValue)
This method converts the given value to an object of the given primitive array Class type. |
protected static java.lang.Object |
convertPrimitiveType(java.lang.Class<?> pClass,
java.lang.String pValue)
This method converts the given value to an object of the given primitive Class type. |
static java.lang.String |
formatStringForDate(java.util.Date pDate)
get the string format for a date object |
static java.lang.Object |
getFilteredPropertyValue(PropertyConfiguration pPropertyConfig,
java.lang.Object pResContainer,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method a filtered property value. |
protected static java.lang.Object |
getMultivaluedElement(java.lang.Object pContainer,
java.lang.String pProperty)
Returns the element in a List or array which is located in the slot specified by pProperty |
static NameValuePair |
getPropertyNameAndValue(java.lang.String[] pPropertyNames,
java.lang.Object pResContainer)
This method returns the property value for a property that is a child or grandchild of the resource container. |
static NameValuePair |
getPropertyNameAndValue(java.lang.String[] pPropertyNames,
java.lang.Object pResContainer,
ComponentConfiguration pCFC,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method returns the property value for a property that is a child or grandchild of the resource container. |
static NameValuePair |
getPropertyNameAndValue(java.lang.String pPropertyName,
java.lang.Object pResContainer)
Convenience method for getting the property name from the given property descriptor and the value from the given resource container. |
static NameValuePair |
getPropertyNameAndValue(java.lang.String pPropertyName,
java.lang.Object pResContainer,
ComponentConfiguration pCFC,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Convenience method for getting the property name from the given property descriptor and the value from the given resource container. |
static boolean |
isIntegerString(java.lang.String pString)
Returns true if pString is a string version of an integer, false otherwise |
static java.lang.String |
removeBrackets(java.lang.String pValue)
Convenience method for removing brackets [ and ] from a String if it contains them. |
static java.lang.String |
removeQuotes(java.lang.String pValue)
Convenience method for removing quotes " or ' from a String if it contains them. |
static void |
setArrayEntryValue(java.lang.Object pArray,
java.lang.String pIndex,
java.lang.String pValue,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Sets the given value into an array element |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.lang.String CLASS_VERSION
| Constructor Detail |
|---|
public BeanUtils()
| Method Detail |
|---|
public static boolean isIntegerString(java.lang.String pString)
pString - the string to test
public static NameValuePair getPropertyNameAndValue(java.lang.String[] pPropertyNames,
java.lang.Object pResContainer)
throws PropertyNotFoundException
pPropertyNames - a String array containing the sub-propertiespResContainer - the object containing the resource
PropertyNotFoundException - if the requested property cannot be found
public static NameValuePair getPropertyNameAndValue(java.lang.String pPropertyName,
java.lang.Object pResContainer)
throws PropertyNotFoundException
pPropertyName - the property name of the property to retrievepResContainer - the object to get the value from
PropertyNotFoundException - if the requested property cannot be foundNameValuePair
public static NameValuePair getPropertyNameAndValue(java.lang.String[] pPropertyNames,
java.lang.Object pResContainer,
ComponentConfiguration pCFC,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pPropertyNames - a String array containing the sub-propertiespResContainer - the object containing the resourcepCFC - a ComponentConfiguration object which contains filtering informationpRequest - the servlet requestpResponse - the servle response
RestException - if the requested property cannot be found or if an io exception occurs
public static NameValuePair getPropertyNameAndValue(java.lang.String pPropertyName,
java.lang.Object pResContainer,
ComponentConfiguration pCFC,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pPropertyName - the property name of the property to retrievepResContainer - the object to get the value frompCFC - a ComponentConfiguration object which contains filtering informationpRequest - the servlet requestpResponse - the servle response
RestException - if the requested property cannot be found or if an io exception occursNameValuePair
public static java.lang.Object getFilteredPropertyValue(PropertyConfiguration pPropertyConfig,
java.lang.Object pResContainer,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException,
java.io.IOException
pPropertyConfig - the PropertyConfiguration object which contains the filtering informationpResContainer - the object container which is the resourcepRequest - the servlet requestpResponse - the servlet response
RestException - if an error occurs processing the REST request
java.io.IOException - if an error occurs writing data to the output object
protected static java.lang.Object getMultivaluedElement(java.lang.Object pContainer,
java.lang.String pProperty)
throws PropertyNotFoundException
pContainer - the container which contains the element desiredpProperty - a string representation of the number which specifies the element to retrieve in the List or array
PropertyNotFoundException - if pProperty is not numeric and the string in pProperty is not a valid property of pContainer
public static void setArrayEntryValue(java.lang.Object pArray,
java.lang.String pIndex,
java.lang.String pValue,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pArray - the array to set the value intopIndex - the array index to setpValue - the value to setpRequest - the servlet requestpResponse - the servlet response
RestException - if data cannot be converted to correct type
java.lang.IllegalArgumentException - if the value is not compatible with the array type or pArray is not an array
public static java.lang.Object convertDataToType(java.lang.Class<?> pClass,
java.lang.String pValue,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pClass - a Class object representing the type that pValue should be converted topValue - a String representation of the value to be convertedpRequest - the servlet requestpResponse - the servlet response
java.lang.IllegalArgumentException - if a value which is to be converted to a repository item cannot be converted or the type was not handled
RestException - if data cannot be converted to specified type
public static java.lang.Object convertDataToType(java.lang.Class<?> pClass,
java.lang.Class<?> pKeyClass,
java.lang.Class<?> pComponentClass,
java.lang.String pValue,
boolean pUseStandardJSON,
JSONObject pControlParamsForJSON,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pClass - a Class object representing the type that pValue should be converted topKeyClass - a Class object representing the type of the keys in the map, if the data is a mappComponentClass - a Class object representing the type of the components of the data, if the data is a multi valuepValue - a String representation of the value to be convertedpUseStandardJSON - flag indicating whether pValue is standard jsonpRequest - the servlet requestpResponse - the servlet response
java.lang.IllegalArgumentException - if a value which is to be converted to a repository item cannot be converted or the type was not handled
RestException - if data cannot be converted to specified type
protected static java.lang.Object convertPrimitiveType(java.lang.Class<?> pClass,
java.lang.String pValue)
pClass - a Class object representing the primitive type that pValue should be converted topValue - a String representation of the value to be converted
protected static java.util.Collection<?> convertCollectionType(java.lang.Class<?> pClass,
java.lang.String pValue,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pClass - a Class object representing the collection type that pValue should be converted topValue - a String representation of the value to be convertedpRequest - the servlet requestpResponse - the servlet response
java.lang.IllegalArgumentException - if the collection cannot be parsed or if the format is incorrect
RestException - if data cannot be converted to collection
protected static java.util.Collection<?> convertCollectionType(java.lang.Class<?> pClass,
java.lang.Class<?> pComponentClass,
java.lang.String pValue,
boolean pUseStandardJSON,
JSONObject pControlParamsForJSON,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pClass - a Class object representing the collection type that pValue should be converted topComponentClass - a Class object representing the type of the components of the data, if the data is a multi valuepValue - a String representation of the value to be convertedpUseStandardJSON - flag indicating whether pValue is standard jsonpRequest - the servlet requestpResponse - the servlet response
java.lang.IllegalArgumentException - if the collection cannot be parsed or if the format is incorrect
RestException - if data cannot be converted to collection
protected static java.util.Map<?,?> convertMapType(java.lang.Class<?> pClass,
java.lang.String pValue,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pClass - a Class object representing the map type that pValue should be converted topValue - a String representation of the value to be convertedpRequest - the servlet requestpResponse - the servlet response
java.lang.IllegalArgumentException - if the map cannot be parsed or if the format is incorrect
RestException - if data cannot be converted to a Map
protected static java.util.Map<?,?> convertMapType(java.lang.Class<?> pClass,
java.lang.Class<?> pKeyClass,
java.lang.Class<?> pValueClass,
java.lang.String pValue,
boolean pUseStandardJSON,
JSONObject pControlParamsForJSON,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pClass - a Class object representing the map type that pValue should be converted topKeyClass - a Class object representing the type of the keys in the mappValueClass - a Class object representing the type of the values in the mappValue - a String representation of the value to be convertedpUseStandardJSON - flag indicating whether pValue is standard jsonpRequest - the servlet requestpResponse - the servlet response
java.lang.IllegalArgumentException - if the map cannot be parsed or if the format is incorrect
RestException - if data cannot be converted to a Map
protected static java.lang.Object convertPrimitiveArrayType(java.lang.Class<?> pClass,
java.lang.String pValue)
pClass - a Class object representing the primitive array type that pValue should be converted topValue - a String representation of the value to be converted
protected static java.lang.Object convertObjectArrayType(java.lang.Class<?> pClass,
java.lang.String pValue,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pClass - a Class object representing the object array type that pValue should be converted topValue - a String representation of the value to be converted
RestException
protected static java.lang.Object convertObjectArrayType(java.lang.Class<?> pClass,
java.lang.String pValue,
boolean pUseStandardJSON,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
throws RestException
pClass - a Class object representing the object array type that pValue should be converted topValue - a String representation of the value to be convertedpUseStandardJSON - flag indicating whether pValue is standard json
RestException
protected static java.util.Date convertDateTimeType(java.lang.Class<?> pClass,
java.lang.String pValue)
pClass - a Class object representing the date or time type that pValue should be converted topValue - a String representation of the value to be converted
java.lang.IllegalArgumentException - if the date cannot be parsed or if the date format is incorrectpublic static java.lang.String formatStringForDate(java.util.Date pDate)
pDate - the date object
public static java.lang.String removeBrackets(java.lang.String pValue)
the - String from which to remove the brackets
public static java.lang.String removeQuotes(java.lang.String pValue)
the - String from which to remove the quotes
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||