Class DataType

java.lang.Object
com.bazaarvoice.jolt.modifier.DataType
Direct Known Subclasses:
DataType.LIST, DataType.MAP, DataType.RUNTIME

public abstract class DataType extends 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 final class 
    List type that records maxIndex from spec, and uses that to expand a source (list) properly
    static final class 
    MAP type class
    static final class 
    Runtime type
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final DataType.MAP
     
    private static final DataType.RUNTIME
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    create(String keyOrIndex, WalkedPath walkedPath, OpMode opMode)
    Creates an empty map/list, as required by spec, in the parent map/list at given key/index
    protected abstract Object
    MAP and LIST types overrides this method to return appropriate new map or list
    static DataType
    determineDataType(int confirmedArrayAtIndex, int confirmedMapAtIndex, int maxExplicitIndex)
     
    expand(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
    abstract boolean
    Determines if an input is compatible with current DataType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • DataType

      public DataType()
  • Method Details

    • determineDataType

      public static DataType determineDataType(int confirmedArrayAtIndex, int confirmedMapAtIndex, int maxExplicitIndex)
    • isCompatible

      public abstract boolean isCompatible(Object input)
      Determines if an input is compatible with current DataType
    • createValue

      protected abstract Object createValue()
      MAP and LIST types overrides this method to return appropriate new map or list
    • expand

      public Integer expand(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 Object create(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 create
      walkedPath - containing the parent object
      opMode - to determine if this write operation is allowed
      Returns:
      newly created object