Class 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) properly
      static class  DataType.MAP
      MAP type class
      static class  DataType.RUNTIME
      Runtime type
    • 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/index
      protected abstract java.lang.Object createValue()
      MAP and LIST types overrides this method to return appropriate new map or list
      static 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 input
      abstract boolean isCompatible​(java.lang.Object input)
      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
    • Constructor Detail

      • DataType

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