Package com.tonic.analysis.query.ast
Enum ArgumentType
- java.lang.Object
-
- java.lang.Enum<ArgumentType>
-
- com.tonic.analysis.query.ast.ArgumentType
-
- All Implemented Interfaces:
Serializable,Comparable<ArgumentType>
public enum ArgumentType extends Enum<ArgumentType>
Classification of how a call argument value is produced, with DYNAMIC covering any non-literal source.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ANYWildcard that accepts every other classification; also the fallback for an unrecognized type keyword.CALLThe argument is the return value of another call.DYNAMICAnything computed at run time; as an expectation it accepts FIELD, LOCAL and CALL.FIELDThe argument comes straight from a field read.LITERALThe argument is a compile-time constant pushed at the call site.LOCALThe argument comes straight from a local variable.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ArgumentTypefromString(String s)Parses a case-insensitive type keyword.booleanmatches(ArgumentType actual)Tests whether an actual argument classification satisfies this expected one.static ArgumentTypevalueOf(String name)Returns the enum constant of this type with the specified name.static ArgumentType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ANY
public static final ArgumentType ANY
Wildcard that accepts every other classification; also the fallback for an unrecognized type keyword.
-
LITERAL
public static final ArgumentType LITERAL
The argument is a compile-time constant pushed at the call site.
-
DYNAMIC
public static final ArgumentType DYNAMIC
Anything computed at run time; as an expectation it accepts FIELD, LOCAL and CALL.
-
FIELD
public static final ArgumentType FIELD
The argument comes straight from a field read.
-
LOCAL
public static final ArgumentType LOCAL
The argument comes straight from a local variable.
-
CALL
public static final ArgumentType CALL
The argument is the return value of another call.
-
-
Method Detail
-
values
public static ArgumentType[] 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 (ArgumentType c : ArgumentType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ArgumentType valueOf(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:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
matches
public boolean matches(ArgumentType actual)
Tests whether an actual argument classification satisfies this expected one.- Parameters:
actual- the classification observed at the call site- Returns:
- true if this type accepts the actual type, with ANY accepting everything and DYNAMIC accepting FIELD, LOCAL, and CALL
-
fromString
public static ArgumentType fromString(String s)
Parses a case-insensitive type keyword.- Parameters:
s- the keyword to parse, may be null- Returns:
- the matching type, or ANY for null or unknown input
-
-