Package de.cxp.ocs.util
Class Util
java.lang.Object
de.cxp.ocs.util.Util
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectcollectObjects(Object oldValue, Object newValue) If both values are not null, this method creates a flat collection of them.deduplicateAdjoinedTokens(String[] inputTokens) static ObjectMake sure, that if we have a number here, it will be represented by float.static ObjectensureSameType(Object referenceObj, Object adjustableObj) static booleanstatic booleanisStringCollection(Object value) Checks weather the passed value is aStringCollectionor 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 aStringCollectionor not.- Parameters:
value- the value to check.- Returns:
trueif the passed object is an string collection,falseotherwise.
-
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
-