Enum Operation.ReturnTypeMode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Operation.ReturnTypeMode>
    Enclosing class:
    Operation

    public static enum Operation.ReturnTypeMode
    extends java.lang.Enum<Operation.ReturnTypeMode>
    Defines how to handle the return type of an operation. We do not provide access to further generic parameters as
    Author:
    Holger Eichelberger
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      GENERIC_PARAM_1
      Change it to the first generic parameter.
      IMMEDIATE_OPERAND
      Change it to the immediate type of the operand.
      IMMEDIATE_OPERAND_COLLECTION
      Change it to a collection based on the original result type using the immediate type as type parameter.
      IMMEDIATE_OPERAND_COLLECTION_NESTED_GENERIC_1
      Change it to the deepest nested first generic operation parameter as generic type of the immediate operand in case that that is a collection.
      IMMEDIATE_OPERAND_COLLECTION_PARAM_1
      Change it to the first generic operation parameter as generic type of the immediate operand in case that that is a collection.
      IMMEDIATE_OPERAND_DEREF
      Change it to the dereferenced immediate type of the operand.
      PARAM_1
      Use the return value of the first operation parameter.
      PARAM_1_CHECK
      Use the return value of the first operation parameter.
      TYPED_META_1
      Change the return type to the value of the operand (first parameter), here required to be a constant type value.
      TYPED_OPERAND_1
      Change the return type to the operand with generic parameter.
      TYPED_PARAM_1
      Change the return type to the type of the operand (first parameter).
      UNCHANGED
      Do not change the return type.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean checkOperand
      Whether the operand (if a collection) shall fit the return type as parameter.
      private int paramIndex
      Stores the index of the source operation parameter.
      private boolean recurse
      Whether searching for the result type shall be applied recursively / in a nested fashion if applicable.
      private int typeIndex
      Stores the index of the affected generic type.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ReturnTypeMode​(int typeIndex, int paramIndex, boolean recurse, boolean checkOperand)
      Creates a new constant based on the affected generic type (index).
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean checkOperand()
      Whether the operand (if a collection) shall fit the return type as parameter.
      int getGenericTypeIndex()
      Returns the index of the relevant generic type.
      int getParameterIndex()
      Returns the index of the relevant parameter.
      boolean recurse()
      Returns whether searching for the result shall be applied in a recursive fashion if applicable.
      static Operation.ReturnTypeMode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Operation.ReturnTypeMode[] 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, toString, valueOf
      • Methods inherited from class java.lang.Object

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

      • IMMEDIATE_OPERAND

        public static final Operation.ReturnTypeMode IMMEDIATE_OPERAND
        Change it to the immediate type of the operand. Do not apply to basic/primitive types.
      • IMMEDIATE_OPERAND_DEREF

        public static final Operation.ReturnTypeMode IMMEDIATE_OPERAND_DEREF
        Change it to the dereferenced immediate type of the operand.
      • TYPED_OPERAND_1

        public static final Operation.ReturnTypeMode TYPED_OPERAND_1
        Change the return type to the operand with generic parameter. If no generic parameter is available, IMMEDIATE_OPERAND is applied.
      • TYPED_META_1

        public static final Operation.ReturnTypeMode TYPED_META_1
        Change the return type to the value of the operand (first parameter), here required to be a constant type value. If no parameter is available, IMMEDIATE_OPERAND is applied.
      • PARAM_1_CHECK

        public static final Operation.ReturnTypeMode PARAM_1_CHECK
        Use the return value of the first operation parameter. If not available, IMMEDIATE_OPERAND is applied. Signals that checking the operand is desired.
      • IMMEDIATE_OPERAND_COLLECTION_PARAM_1

        public static final Operation.ReturnTypeMode IMMEDIATE_OPERAND_COLLECTION_PARAM_1
        Change it to the first generic operation parameter as generic type of the immediate operand in case that that is a collection. If the IMMEDIATE_OPERAND is not a collection, PARAM_1 will be applied. If no parameter parameter is available, IMMEDIATE_OPERAND is applied.
      • IMMEDIATE_OPERAND_COLLECTION_NESTED_GENERIC_1

        public static final Operation.ReturnTypeMode IMMEDIATE_OPERAND_COLLECTION_NESTED_GENERIC_1
        Change it to the deepest nested first generic operation parameter as generic type of the immediate operand in case that that is a collection. If the IMMEDIATE_OPERAND is not a collection, PARAM_1 will be applied. If no parameter parameter is available, IMMEDIATE_OPERAND is applied.
      • IMMEDIATE_OPERAND_COLLECTION

        public static final Operation.ReturnTypeMode IMMEDIATE_OPERAND_COLLECTION
        Change it to a collection based on the original result type using the immediate type as type parameter.
    • Field Detail

      • typeIndex

        private int typeIndex
        Stores the index of the affected generic type. Negative if none is affected.
      • paramIndex

        private int paramIndex
        Stores the index of the source operation parameter. Negative if none is considered.
      • recurse

        private boolean recurse
        Whether searching for the result type shall be applied recursively / in a nested fashion if applicable.
      • checkOperand

        private boolean checkOperand
        Whether the operand (if a collection) shall fit the return type as parameter.
    • Constructor Detail

      • ReturnTypeMode

        private ReturnTypeMode​(int typeIndex,
                               int paramIndex,
                               boolean recurse,
                               boolean checkOperand)
        Creates a new constant based on the affected generic type (index).
        Parameters:
        typeIndex - the affected generic type (negative if none is affected)
        paramIndex - the parameter type to be considered as return (none: relevant)
        recurse - searching for the result type shall be applied recursively
        checkOperand - whether the operand (if a collection) shall fit the return type as parameter
    • Method Detail

      • values

        public static Operation.ReturnTypeMode[] 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 (Operation.ReturnTypeMode c : Operation.ReturnTypeMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Operation.ReturnTypeMode 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
      • checkOperand

        public boolean checkOperand()
        Whether the operand (if a collection) shall fit the return type as parameter.
        Returns:
        true for check, false else
      • getGenericTypeIndex

        public int getGenericTypeIndex()
        Returns the index of the relevant generic type.
        Returns:
        a negative value if no generic type is affected, the affected index else
      • getParameterIndex

        public int getParameterIndex()
        Returns the index of the relevant parameter.
        Returns:
        a negative value if no parameter should be considered, the index else
      • recurse

        public boolean recurse()
        Returns whether searching for the result shall be applied in a recursive fashion if applicable.
        Returns:
        true do recursion, false no recursion