public class BeanUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
Constructor and Description |
---|
BeanUtils() |
Modifier and Type | Method and Description |
---|---|
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.
|
static java.lang.Integer |
convertObjectToInteger(java.lang.Object pObj) |
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,
java.lang.String pTimeZoneId)
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
|
public static boolean isIntegerString(java.lang.String pString)
pString
- the string to testpublic 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 resourcePropertyNotFoundException
- if the requested property cannot be foundpublic 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 fromPropertyNotFoundException
- 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 responseRestException
- if the requested property cannot be found or if an io exception occurspublic 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 responseRestException
- 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 responseRestException
- if an error occurs processing the REST requestjava.io.IOException
- if an error occurs writing data to the output objectprotected 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 arrayPropertyNotFoundException
- if pProperty is not numeric and the string in pProperty is not a valid property of pContainerpublic 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 responseRestException
- if data cannot be converted to correct typejava.lang.IllegalArgumentException
- if the value is not compatible with the array type or pArray is not an arraypublic 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 responsejava.lang.IllegalArgumentException
- if a value which is to be converted to a repository item cannot be converted or the type was not handledRestException
- if data cannot be converted to specified typepublic 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 responsejava.lang.IllegalArgumentException
- if a value which is to be converted to a repository item cannot be converted or the type was not handledRestException
- if data cannot be converted to specified typeprotected 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 convertedprotected 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 responsejava.lang.IllegalArgumentException
- if the collection cannot be parsed or if the format is incorrectRestException
- if data cannot be converted to collectionprotected 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 responsejava.lang.IllegalArgumentException
- if the collection cannot be parsed or if the format is incorrectRestException
- if data cannot be converted to collectionprotected 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 responsejava.lang.IllegalArgumentException
- if the map cannot be parsed or if the format is incorrectRestException
- if data cannot be converted to a Mapprotected 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 responsejava.lang.IllegalArgumentException
- if the map cannot be parsed or if the format is incorrectRestException
- if data cannot be converted to a Mapprotected 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 convertedprotected 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 convertedRestException
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 jsonRestException
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 convertedjava.lang.IllegalArgumentException
- if the date cannot be parsed or if the date format is incorrectpublic static java.lang.String formatStringForDate(java.util.Date pDate, java.lang.String pTimeZoneId)
pDate
- the date objectpublic static java.lang.String removeBrackets(java.lang.String pValue)
the
- String from which to remove the bracketspublic static java.lang.String removeQuotes(java.lang.String pValue)
the
- String from which to remove the quotespublic static java.lang.Integer convertObjectToInteger(java.lang.Object pObj)