Class OMultiValue
java.lang.Object
com.orientechnologies.common.collection.OMultiValue
Handles Multi-value types such as Arrays, Collections and Maps. It recognizes special Orient
collections.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectUtility function that add a value to the main object.static Object[]static <T> T[]static <T> T[]static booleanstatic Objectstatic booleanequals(Collection<Object> col1, Collection<Object> col2) static ObjectgetFirstValue(Object iObject) Returns the first item of the Multi-value object (array, collection or map)static ObjectgetLastValue(Object iObject) Returns the last item of the Multi-value object (array, collection or map)getMultiValueIterable(Object iObject) Returns anIterableobject to browse the multi-value instance (array, collection or map).getMultiValueIterable(Object iObject, boolean iForceConvertRecord) Returns anIterableobject to browse the multi-value instance (array, collection or map).getMultiValueIterator(Object iObject) Returns anIteratorobject to browse the multi-value instance (array, collection or map)getMultiValueIterator(Object iObject, boolean iForceConvertRecord) Returns anIteratorobject to browse the multi-value instance (array, collection or map)static <T> List<T>getSingletonList(T item) static intReturns the size of the multi-value objectstatic ObjectReturns the iIndex item of the Multi-value object (array, collection or map)static booleanisIterable(Object iObject) static booleanisMultiValue(Class<?> iType) Checks if a class is a multi-value type.static booleanisMultiValue(Object iObject) Checks if the object is a multi-value type.static ObjectUtility function that remove a value from the main object.protected static voidremoveFromOCollection(Object iObject, OCollection<Object> coll, Object iToRemove, boolean iAllOccurrences) static voidSets the value of the Multi-value object (array or collection) at iIndexstatic Objectstatic StringReturns a stringified version of the multi-value object.
-
Constructor Details
-
OMultiValue
public OMultiValue()
-
-
Method Details
-
isMultiValue
Checks if a class is a multi-value type.- Parameters:
iType- Class to check- Returns:
- true if it's an array, a collection or a map, otherwise false
-
isMultiValue
Checks if the object is a multi-value type.- Parameters:
iObject- Object to check- Returns:
- true if it's an array, a collection or a map, otherwise false
-
isIterable
-
getSize
Returns the size of the multi-value object- Parameters:
iObject- Multi-value object (array, collection or map)- Returns:
- the size of the multi value object
-
getFirstValue
Returns the first item of the Multi-value object (array, collection or map)- Parameters:
iObject- Multi-value object (array, collection or map)- Returns:
- The first item if any
-
getLastValue
Returns the last item of the Multi-value object (array, collection or map)- Parameters:
iObject- Multi-value object (array, collection or map)- Returns:
- The last item if any
-
getValue
Returns the iIndex item of the Multi-value object (array, collection or map)- Parameters:
iObject- Multi-value object (array, collection or map)iIndex- integer as the position requested- Returns:
- The first item if any
-
setValue
Sets the value of the Multi-value object (array or collection) at iIndex- Parameters:
iObject- Multi-value object (array, collection)iValue- The value to set at this specified index.iIndex- integer as the position requested
-
getMultiValueIterable
Returns anIterableobject to browse the multi-value instance (array, collection or map).- Parameters:
iObject- Multi-value object (array, collection or map)
-
getMultiValueIterable
Returns anIterableobject to browse the multi-value instance (array, collection or map).- Parameters:
iObject- Multi-value object (array, collection or map)iForceConvertRecord- allow to force settings to convert RIDs to records while browsing.
-
getMultiValueIterator
Returns anIteratorobject to browse the multi-value instance (array, collection or map)- Parameters:
iObject- Multi-value object (array, collection or map)iForceConvertRecord- allow to force settings to convert RIDs to records while browsing.
-
getMultiValueIterator
Returns anIteratorobject to browse the multi-value instance (array, collection or map)- Parameters:
iObject- Multi-value object (array, collection or map)
-
toString
Returns a stringified version of the multi-value object.- Parameters:
iObject- Multi-value object (array, collection or map)- Returns:
- a stringified version of the multi-value object.
-
add
Utility function that add a value to the main object. It takes care about collections/array and single values.- Parameters:
iObject- MultiValue where to add value(s)iToAdd- Single value, array of values or collections of values. Map are not supported.- Returns:
-
remove
Utility function that remove a value from the main object. It takes care about collections/array and single values.- Parameters:
iObject- MultiValue where to add value(s)iToRemove- Single value, array of values or collections of values. Map are not supported.iAllOccurrences- True if the all occurrences must be removed or false of only the first one (Like java.util.Collection.remove())- Returns:
-
removeFromOCollection
protected static void removeFromOCollection(Object iObject, OCollection<Object> coll, Object iToRemove, boolean iAllOccurrences) -
array
-
array
-
array
-
convert
-
equals
-
contains
-
toSet
-
getSingletonList
-