Package com.bazaarvoice.jolt.modifier
Class DataType
- java.lang.Object
-
- com.bazaarvoice.jolt.modifier.DataType
-
- Direct Known Subclasses:
DataType.LIST
,DataType.MAP
,DataType.RUNTIME
public abstract class DataType extends java.lang.Object
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 Classes Modifier and Type Class Description static class
DataType.LIST
List type that records maxIndex from spec, and uses that to expand a source (list) properlystatic class
DataType.MAP
MAP type classstatic class
DataType.RUNTIME
Runtime type
-
Field Summary
Fields Modifier and Type Field Description private static DataType.MAP
mapInstance
private static DataType.RUNTIME
runtimeInstance
-
Constructor Summary
Constructors Constructor Description DataType()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Object
create(java.lang.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 java.lang.Object
createValue()
MAP and LIST types overrides this method to return appropriate new map or liststatic DataType
determineDataType(int confirmedArrayAtIndex, int confirmedMapAtIndex, int maxExplicitIndex)
java.lang.Integer
expand(java.lang.Object source)
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(java.lang.Object input)
Determines if an input is compatible with current DataType
-
-
-
Field Detail
-
runtimeInstance
private static final DataType.RUNTIME runtimeInstance
-
mapInstance
private static final DataType.MAP mapInstance
-
-
Method Detail
-
determineDataType
public static DataType determineDataType(int confirmedArrayAtIndex, int confirmedMapAtIndex, int maxExplicitIndex)
-
isCompatible
public abstract boolean isCompatible(java.lang.Object input)
Determines if an input is compatible with current DataType
-
createValue
protected abstract java.lang.Object createValue()
MAP and LIST types overrides this method to return appropriate new map or list
-
expand
public java.lang.Integer expand(java.lang.Object source)
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
public java.lang.Object create(java.lang.String keyOrIndex, WalkedPath walkedPath, OpMode opMode)
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
-
-