Enum OpMode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<OpMode>

    public enum OpMode
    extends java.lang.Enum<OpMode>
    OpMode differentiates different flavors of Templatr Templatr can fill in leaf values as required in spec from a specified context, self or a hardcoded default value. However whether or not that 'write' operation should go through, is determined by this enum. All of these opModes validates if the if the source (map or list) and the key/index are valid, i.e. not null or >= 0, etc. OVERWRITR always writes DEFAULTR only writes when the the value at the key/index is null DEFINR only writes when source does not contain the key/index
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String op
      Identifier OP prefix that is defined in SPEC
      private static java.util.Map<java.lang.String,​OpMode> opModeMap
      Static validity checker and instance getter from given op String
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private OpMode​(java.lang.String op)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static OpMode from​(java.lang.String op)  
      java.lang.String getOp()  
      boolean isApplicable​(java.util.List source, int reqIndex, int origSize)
      Given a source list and a input index and original size of the list (when passed in as input) returns true if it is ok to go ahead with write operation given a specific opMode
      boolean isApplicable​(java.util.Map source, java.lang.String key)
      Given a source map and a input key returns true if it is ok to go ahead with write operation given a specific opMode
      static boolean isValid​(java.lang.String op)  
      java.lang.String toString()  
      static OpMode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static OpMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • OVERWRITR

        public static final OpMode OVERWRITR
      • DEFAULTR

        public static final OpMode DEFAULTR
      • DEFINER

        public static final OpMode DEFINER
    • Field Detail

      • op

        private java.lang.String op
        Identifier OP prefix that is defined in SPEC
      • opModeMap

        private static java.util.Map<java.lang.String,​OpMode> opModeMap
        Static validity checker and instance getter from given op String
    • Constructor Detail

      • OpMode

        private OpMode​(java.lang.String op)
    • Method Detail

      • values

        public static OpMode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (OpMode c : OpMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static OpMode valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getOp

        public java.lang.String getOp()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<OpMode>
      • isApplicable

        public boolean isApplicable​(java.util.Map source,
                                    java.lang.String key)
        Given a source map and a input key returns true if it is ok to go ahead with write operation given a specific opMode
      • isApplicable

        public boolean isApplicable​(java.util.List source,
                                    int reqIndex,
                                    int origSize)
        Given a source list and a input index and original size of the list (when passed in as input) returns true if it is ok to go ahead with write operation given a specific opMode
      • isValid

        public static boolean isValid​(java.lang.String op)
      • from

        public static OpMode from​(java.lang.String op)