Class NestedAttributeUtils
- java.lang.Object
-
- de.hybris.platform.omsbackoffice.renderers.NestedAttributeUtils
-
public class NestedAttributeUtils extends java.lang.ObjectContains common methods to the various nested attribute renderers.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFAIL_TO_FIND_COLLECTION_ITEMstatic java.lang.StringGETTER
-
Constructor Summary
Constructors Constructor Description NestedAttributeUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetArrayItem(java.lang.Object object, java.lang.String propertyName)Retreives a collection item at a specified index.java.lang.StringgetNameOfClassWithoutModel(java.lang.Object object)Obtain the name of the class that the object belongs to, but without the "Model" at the end.java.lang.ObjectgetNestedObject(java.lang.Object object, java.lang.String propertyName)Retrieve the instance of an attribute of an object.java.lang.ObjectinvokePropertyAsMethod(java.lang.Object object, java.lang.String propertyName)Converts a property to a getter.java.lang.StringpropertyNameToGetter(java.lang.String propertyName)Convert a string representing an attribute name to the name of a getter method.java.util.List<java.lang.String>splitQualifier(java.lang.String qualifier)Splits a qualifier for a nested attribute (ex.
-
-
-
Field Detail
-
GETTER
public static final java.lang.String GETTER
- See Also:
- Constant Field Values
-
FAIL_TO_FIND_COLLECTION_ITEM
public static final java.lang.String FAIL_TO_FIND_COLLECTION_ITEM
- See Also:
- Constant Field Values
-
-
Method Detail
-
propertyNameToGetter
public java.lang.String propertyNameToGetter(java.lang.String propertyName)
Convert a string representing an attribute name to the name of a getter method.
-
splitQualifier
public java.util.List<java.lang.String> splitQualifier(java.lang.String qualifier)
Splits a qualifier for a nested attribute (ex. product.name) into a map to retrieve the two tokens.
-
getNestedObject
public java.lang.Object getNestedObject(java.lang.Object object, java.lang.String propertyName) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException, InvalidNestedAttributeExceptionRetrieve the instance of an attribute of an object.- Throws:
java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.NoSuchMethodExceptionInvalidNestedAttributeException
-
getNameOfClassWithoutModel
public java.lang.String getNameOfClassWithoutModel(java.lang.Object object)
Obtain the name of the class that the object belongs to, but without the "Model" at the end.
-
getArrayItem
public java.lang.Object getArrayItem(java.lang.Object object, java.lang.String propertyName) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException, InvalidNestedAttributeExceptionRetreives a collection item at a specified index.- Parameters:
object- Object containing the collection.propertyName- Collection item with this format: collection[i]- Returns:
- object at specified index.
- Throws:
java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.NoSuchMethodExceptionInvalidNestedAttributeException
-
invokePropertyAsMethod
public java.lang.Object invokePropertyAsMethod(java.lang.Object object, java.lang.String propertyName) throws java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessExceptionConverts a property to a getter. Invokes it as a method on the passed object.- Parameters:
object- Object to invoke the method on.propertyName- Property to invoke as method.- Returns:
- Result of the method invocation
- Throws:
java.lang.NoSuchMethodExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.IllegalAccessException
-
-