public class ClientUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
addNamedValueToMultiMap(Map map,
NamedValue nv)
Adds a NamedValue to a MultiMap.
|
static Calendar |
convertDate(Object date)
Converts an object to a Calendar.
|
static String |
fdkExceptionEntryToString(FdkExceptionEntry fdkee)
Returns a String representation of a FdkExceptionEntry, suitable for
detail logging.
|
static String |
fdkExceptionToString(FdkException fdke,
boolean includeStackTrace)
Returns a String representation of a FdkException, suitable for
detail logging.
|
static NamedValue[] |
getIdErrorInfo(long id)
Returns an NamedValue[] info filled in with the ID of the object where the
error occured.
|
static NamedValue[] |
getIdErrorInfo(Long id)
Returns an NamedValue[] info filled in with the ID of the object where the
error occured.
|
static long[] |
getSupportedCapabilities()
Returns a list of capabilities that are supported.
|
static boolean |
isDocument(String type)
Returns true if the given type is one of the document types.
|
static boolean |
isFolder(String type)
Returns true if the given type is one of the folder types.
|
static boolean |
isLink(String type)
Returns true if the given type is one of the link types.
|
static String |
itemToString(Item item)
Returns a String representation of an Item.
|
static NamedValue[] |
mapToNamedValues(Map map)
Converts an Map of named values to NamedValue[].
|
static NamedValue[] |
multiMapToNamedValues(Map map)
Converts a MultiMap of named values to a NamedValue[].
|
static int |
multiMapTotalSize(Map map)
Gets the total size of the MultiMap.
|
static Map |
namedValuesToMap(NamedValue[] namedValues)
Converts a NamedValue[] to a Map for easy access.
|
static Map |
namedValuesToMultiMap(NamedValue[] namedValues)
Converts a NamedValue[] to a MultiMap enabling multiple values to be mapped
to a single key.
|
static String |
namedValueToString(NamedValue nv)
Returns a String representation of a NamedValue.
|
static AttributeRequest |
newAttributeRequest(String attributeName)
Creates a new AttributeRequest without requesting any additional
attributes.
|
static AttributeRequest |
newAttributeRequest(String attributeName,
AttributeRequest[] attributes)
Creates a new AttributeRequest.
|
static NamedValue |
newNamedValue(String name,
Object value)
Creates a new NamedValue.
|
static boolean |
removeNamedValueFromMultiMap(Map map,
NamedValue nv)
Removes the first occurrence of a NamedValue from a MultiMap.
|
static String |
stackTraceToString(Throwable t)
Converts an exception stack trace to a String.
|
static String |
toString(Object o)
Returns a String representation of any Object, with special handling
for known objects such as Item, NamedValue, FdkException,
FdkExceptionEntry, etc.
|
public static final Map namedValuesToMap(NamedValue[] namedValues)
String
.namedValues
- The NamedValue[] to convert. A zero-length array
will result into an empty map and a null
array will result into a null
return
value.public static final NamedValue[] mapToNamedValues(Map map)
map
- The Map to convert. The keys in the map must be of
type String
. An empty map will result
in a zero-length NamedValue[] and a null
map will result in a null
return value.public static NamedValue[] getIdErrorInfo(Long id)
public static NamedValue[] getIdErrorInfo(long id)
public static final String toString(Object o)
o
- Object to convert to a String.public static final String itemToString(Item item)
item
- Item to convert to String.public static final String namedValueToString(NamedValue nv)
nv
- NamedValue to convert to String.public static final String fdkExceptionToString(FdkException fdke, boolean includeStackTrace)
fdke
- Exception to convert to String.includeStackTrace
- Whether to include the stack trace of the
exception in the returned String.public static final String fdkExceptionEntryToString(FdkExceptionEntry fdkee)
fdkee
- Entry to convert to String.public static final String stackTraceToString(Throwable t)
t
- The exception to convert.public static final NamedValue newNamedValue(String name, Object value)
name
- The name.value
- The value.public static final AttributeRequest newAttributeRequest(String attributeName, AttributeRequest[] attributes)
attributeName
- The attribute name.attributes
- The requested attributes to be retrieved for the
attribute.public static final AttributeRequest newAttributeRequest(String attributeName)
attributeName
- The attribute name.public static final boolean isFolder(String type)
type
- The type to check.public static final boolean isDocument(String type)
type
- The type to check.public static final boolean isLink(String type)
type
- The type to check.public static final Calendar convertDate(Object date)
date
- The Calendar or Date object to convert. For other
object types a RuntimeException will be thrown.public static long[] getSupportedCapabilities()
public static Map namedValuesToMultiMap(NamedValue[] namedValues)
String
.
The Map value is of type List
and contains a list of
NamedValue instance Value components that match the particular key.namedValues
- The NamedValue[] to convert. A zero-length array
will result into an empty map and a null
array will result into a null
return
value.public static NamedValue[] multiMapToNamedValues(Map map)
String
.
The Map value is of type List
and contains a list of
NamedValue instance Value components that match the particular key.map
- The MultiMap to convert.
An empty map will result in a zero-length NamedValue[] and a
null
map will result in a null
return
value.public static int multiMapTotalSize(Map map)
String
.
The Map value is of type List
and contains a list of
NamedValue instance Value components that match the particular key.map
- The MultiMap to size.public static boolean addNamedValueToMultiMap(Map map, NamedValue nv)
String
.
The Map value is of type List
and contains a list of
NamedValue instance Value components that match the particular key.map
- The MultiMap to add to.nv
- The NamedValue instance to add.public static boolean removeNamedValueFromMultiMap(Map map, NamedValue nv)
String
.
The Map value is of type List
and contains a list of
NamedValue instance Value components that match the particular key.map
- The MultiMap to remove from.nv
- The NamedValue instance to remove.Copyright © 2023. All rights reserved.