Class ObjectModel
java.lang.Object
com.blueriq.component.api.externalflow.data.ObjectModel
- All Implemented Interfaces:
ObjectModelCreation, ObjectModelRetrieval, ObjectModelStorage
public class ObjectModel
extends Object
implements ObjectModelCreation, ObjectModelRetrieval, ObjectModelStorage
The
ObjectModel is not thread-safe and should not be shared over multiple threads, unless the object is
synchronized by the caller.-
Constructor Summary
ConstructorsConstructorDescriptionObjectModel(byte[] jsonBytesArray) Construct an object model using byte array containing json.ObjectModel(tools.jackson.databind.JsonNode jsonNode) -
Method Summary
Modifier and TypeMethodDescriptioncreateArray(String key) A function that creates aArrayModelCreationand put is in the currentObjectModelCreationunder the provided key.createObject(String key) A function that creates aObjectModelCreationand put is in the currentObjectModelCreationunder the provided key.booleangetBoolean(String property) intgetInteger(String property) getObjectStream(String property) String[]getStringArray(String property) getStringList(String property) getStringStream(String property) booleanbooleanhasNonNull(String key) booleanbooleanisEmpty()voidvoidvoidvoidputIfAbsent(String key, boolean value) voidputIfAbsent(String key, int value) voidputIfAbsent(String key, String value) voidputIfAbsent(String key, Consumer<ObjectModelCreation> objectModelConsumer) A function that creates aObjectModelCreationand put is in the currentObjectModelCreationunder the provided key when it isn't already set.voidvoidputNullIfAbsent(String key) byte[]toBytes()A function that can be used to serialize theObjectModelStorageto a byte array.
-
Constructor Details
-
ObjectModel
public ObjectModel() -
ObjectModel
public ObjectModel(byte[] jsonBytesArray) Construct an object model using byte array containing json. The expected encoding should be UTF-8- Parameters:
jsonBytesArray- UTF-8 encoded json byte array
-
ObjectModel
public ObjectModel(tools.jackson.databind.JsonNode jsonNode)
-
-
Method Details
-
put
- Specified by:
putin interfaceObjectModelCreation
-
put
- Specified by:
putin interfaceObjectModelCreation
-
put
- Specified by:
putin interfaceObjectModelCreation
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceObjectModelCreation
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceObjectModelCreation
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceObjectModelCreation
-
putIfAbsent
Description copied from interface:ObjectModelCreationA function that creates aObjectModelCreationand put is in the currentObjectModelCreationunder the provided key when it isn't already set. The createdObjectModelCreationcan be used to provide data for a nested Object. The consumption will only happen if the key is not already set.- Specified by:
putIfAbsentin interfaceObjectModelCreation- Parameters:
key- key to store the object model under.objectModelConsumer- aConsumerto fills the providedObjectModelCreationwith data.
-
putNull
- Specified by:
putNullin interfaceObjectModelCreation
-
putNullIfAbsent
- Specified by:
putNullIfAbsentin interfaceObjectModelCreation
-
createArray
Description copied from interface:ObjectModelCreationA function that creates aArrayModelCreationand put is in the currentObjectModelCreationunder the provided key.- Specified by:
createArrayin interfaceObjectModelCreation- Parameters:
key- key to store the array model under.- Returns:
- the array model.
-
createObject
Description copied from interface:ObjectModelCreationA function that creates aObjectModelCreationand put is in the currentObjectModelCreationunder the provided key.- Specified by:
createObjectin interfaceObjectModelCreation- Parameters:
key- key to store the object model under.- Returns:
- the array model.
-
has
- Specified by:
hasin interfaceObjectModelRetrieval
-
hasNonNull
- Specified by:
hasNonNullin interfaceObjectModelRetrieval
-
getString
- Specified by:
getStringin interfaceObjectModelRetrieval
-
getInteger
- Specified by:
getIntegerin interfaceObjectModelRetrieval
-
getBoolean
- Specified by:
getBooleanin interfaceObjectModelRetrieval
-
getStringArray
- Specified by:
getStringArrayin interfaceObjectModelRetrieval
-
getStringList
- Specified by:
getStringListin interfaceObjectModelRetrieval
-
getStringStream
- Specified by:
getStringStreamin interfaceObjectModelRetrieval
-
getObject
- Specified by:
getObjectin interfaceObjectModelRetrieval
-
getObjectStream
- Specified by:
getObjectStreamin interfaceObjectModelRetrieval
-
isArray
- Specified by:
isArrayin interfaceObjectModelRetrieval
-
toBytes
public byte[] toBytes()Description copied from interface:ObjectModelStorageA function that can be used to serialize theObjectModelStorageto a byte array. The byte array represents a encoded UTF-8 JSON string of the object model.- Specified by:
toBytesin interfaceObjectModelStorage- Returns:
- a byte array containing the UTF-8 encode JSON string of the object model.
-
getProperties
- Specified by:
getPropertiesin interfaceObjectModelRetrieval
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceObjectModelRetrieval
-