Package de.cxp.ocs.util
Class Util
java.lang.Object
de.cxp.ocs.util.Util
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
collectObjects
(Object oldValue, Object newValue) If both values are not null, this method creates a flat collection of them.deduplicateAdjoinedTokens
(String[] inputTokens) static Object
Make sure, that if we have a number here, it will be represented by float.static Object
ensureSameType
(Object referenceObj, Object adjustableObj) static boolean
static boolean
isStringCollection
(Object value) Checks weather the passed value is aString
Collection
or not.static Collection
<Number> toNumberCollection
(Object value) static Collection
<String> toStringCollection
(Object value) tryToParseAsNumber
(Object numVal)
-
Method Details
-
tryToParseAsNumber
-
collectObjects
If both values are not null, this method creates a flat collection of them. By default a HashSet is used as collection. If this is not wanted, pass another collection type as value. If one value is null, the other is returned and no collection is created. The inner types of the collection are not checked, so it's possible to merge different types into a collection. If a given value is an array, it will be transformed into a collection. Multidimensional arrays become a collection of array.- Parameters:
oldValue
-newValue
-- Returns:
-
toStringCollection
-
toNumberCollection
-
asMap
-
isStringCollection
Checks weather the passed value is aString
Collection
or not.- Parameters:
value
- the value to check.- Returns:
true
if the passed object is an string collection,false
otherwise.
-
deduplicateAdjoinedTokens
-
ensureSameType
-
ensureNumberIsFloat
Make sure, that if we have a number here, it will be represented by float. If it's not a number, the object will be returned as is.- Returns:
-
isEmpty
-