Package com.bazaarvoice.jolt.modifier
Class DataType
java.lang.Object
com.bazaarvoice.jolt.modifier.DataType
- Direct Known Subclasses:
DataType.LIST
,DataType.MAP
,DataType.RUNTIME
From the spec we need to guess the DataType of the incoming input
This is useful for,
a) in cases where the spec suggested a list but input was map
and vice versa, where we can just skip processing instead of
throwing random array/map errors
b) in case where the input is actually null and we need to create
appropriate data structure and then apply spec logic
Note: By design jolt does not stop processing on bad input data
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
List type that records maxIndex from spec, and uses that to expand a source (list) properlystatic final class
MAP type classstatic final class
Runtime type -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final DataType.MAP
private static final DataType.RUNTIME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate
(String keyOrIndex, WalkedPath walkedPath, OpMode opMode) Creates an empty map/list, as required by spec, in the parent map/list at given key/indexprotected abstract Object
MAP and LIST types overrides this method to return appropriate new map or liststatic DataType
determineDataType
(int confirmedArrayAtIndex, int confirmedMapAtIndex, int maxExplicitIndex) LIST overrides this method to expand the source (list) such that in can support an index specified in spec that is outside the range input list, returns original size of the inputabstract boolean
isCompatible
(Object input) Determines if an input is compatible with current DataType
-
Field Details
-
runtimeInstance
-
mapInstance
-
-
Constructor Details
-
DataType
public DataType()
-
-
Method Details
-
determineDataType
public static DataType determineDataType(int confirmedArrayAtIndex, int confirmedMapAtIndex, int maxExplicitIndex) -
isCompatible
Determines if an input is compatible with current DataType -
createValue
MAP and LIST types overrides this method to return appropriate new map or list -
expand
LIST overrides this method to expand the source (list) such that in can support an index specified in spec that is outside the range input list, returns original size of the input -
create
Creates an empty map/list, as required by spec, in the parent map/list at given key/index- Parameters:
keyOrIndex
- of the parent object to createwalkedPath
- containing the parent objectopMode
- to determine if this write operation is allowed- Returns:
- newly created object
-