@ProviderType public final class TypeUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Map<T,T> |
arrayToMap(T[] list)
Turn a even length Array into a Map.
|
static <T> Class<T> |
getType(Object object)
Determines the type of the parameter object.
|
static Map<String,Object> |
toMap(com.google.gson.JsonObject json)
Convenience wrapper for toMap(jsonObj, Object.class).
|
static <T> T |
toObjectType(String data,
Class<T> klass)
Converts a limited set of String representations to their corresponding Objects
Supports
* Double
* Long
* Integer
* Boolean (true/false)
* Dates in string format of ISODateTimeFormat
Else, null is returned.
|
static String |
toString(Object obj)
Attempt to create a string representation of an object.
|
static String |
toString(Object obj,
Class<?> klass)
Gets the default string representation of the parameter object.
|
static String |
toString(Object obj,
Class<?> klass,
String methodName)
Gets a custom string representation based on the parameter (0 argument) methodName.
|
static org.apache.sling.api.resource.ValueMap |
toValueMap(Map<String,?> map)
Transforms a Map of &lgt;String, ?> into a ValueMap.
|
public static <T> Map<T,T> arrayToMap(T[] list)
T - list - public static Map<String,Object> toMap(com.google.gson.JsonObject json)
json - public static <T> Class<T> getType(Object object)
T - object - public static <T> T toObjectType(String data, Class<T> klass)
T - the target class type of the provided datadata - the String representation of the dataklass - the target class type of the provided datapublic static String toString(Object obj, Class<?> klass) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException
obj - klass - IllegalAccessExceptionNoSuchMethodExceptionInvocationTargetExceptionpublic static String toString(Object obj, Class<?> klass, String methodName) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException
obj - klass - methodName - InvocationTargetExceptionIllegalAccessExceptionNoSuchMethodExceptionpublic static String toString(Object obj) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException
obj - the object to represent as a stringInvocationTargetExceptionIllegalAccessExceptionNoSuchMethodExceptionCopyright © 2013–2020 Adobe. All rights reserved.