Package com.indeed.proctor.common
Enum PayloadType
- java.lang.Object
-
- java.lang.Enum<PayloadType>
-
- com.indeed.proctor.common.PayloadType
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<PayloadType>
public enum PayloadType extends java.lang.Enum<PayloadType>
enum for dealing with Payload types. Used in code generation for mapping between payload type names, java class names, and accessor names.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DOUBLE_ARRAYDOUBLE_VALUEJSONLONG_ARRAYLONG_VALUEMAPSTRING_ARRAYSTRING_VALUE
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringjavaAccessorNamejava.lang.StringjavaClassNamejava.lang.StringjavascriptTypeNamejava.lang.StringpayloadTypeName
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.util.List<java.lang.String>allTypeNames()For printing useful error messages, the proctor webapp, and for testing.java.lang.StringgetDefaultJavascriptValue()booleanisArrayType()booleanpayloadHasThisType(Payload payload)Deprecated.use Payload.hasTypestatic PayloadTypepayloadTypeForName(java.lang.String payloadTypeName)Given a Payload field name, return its corresponding PayloadType.static PayloadTypepayloadTypeForValue(java.lang.Object payloadValue)Flexible method for determining payload type from a value - helpful for determining the schema of map payload typesstatic PayloadTypevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static PayloadType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DOUBLE_VALUE
public static final PayloadType DOUBLE_VALUE
-
DOUBLE_ARRAY
public static final PayloadType DOUBLE_ARRAY
-
LONG_VALUE
public static final PayloadType LONG_VALUE
-
LONG_ARRAY
public static final PayloadType LONG_ARRAY
-
STRING_VALUE
public static final PayloadType STRING_VALUE
-
STRING_ARRAY
public static final PayloadType STRING_ARRAY
-
MAP
public static final PayloadType MAP
-
JSON
public static final PayloadType JSON
-
-
Field Detail
-
payloadTypeName
@Nonnull public final java.lang.String payloadTypeName
-
javaClassName
@Nonnull public final java.lang.String javaClassName
-
javascriptTypeName
@Nonnull public final java.lang.String javascriptTypeName
-
javaAccessorName
@Nonnull public final java.lang.String javaAccessorName
-
-
Method Detail
-
values
public static PayloadType[] 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 (PayloadType c : PayloadType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PayloadType 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 namejava.lang.NullPointerException- if the argument is null
-
payloadHasThisType
@Deprecated public boolean payloadHasThisType(@Nullable Payload payload)Deprecated.use Payload.hasTypeSee whether a given Payload has a specified type. This could also be done with introspection, and might belong in the Payload bean itself.- Parameters:
payload- A payload- Returns:
- true if the payload has the type
-
getDefaultJavascriptValue
public java.lang.String getDefaultJavascriptValue()
-
payloadTypeForName
@Nonnull public static PayloadType payloadTypeForName(@Nonnull java.lang.String payloadTypeName) throws java.lang.IllegalArgumentException
Given a Payload field name, return its corresponding PayloadType.- Parameters:
payloadTypeName- a string of payload type- Returns:
- null if it isn't an existing field name.
- Throws:
java.lang.IllegalArgumentException
-
payloadTypeForValue
@Nonnull public static PayloadType payloadTypeForValue(@Nullable java.lang.Object payloadValue) throws java.lang.IllegalArgumentException
Flexible method for determining payload type from a value - helpful for determining the schema of map payload types- Parameters:
payloadValue- a payload value- Returns:
- the payload type determined from the given value
- Throws:
java.lang.IllegalArgumentException- if type cannot be determined
-
allTypeNames
@Nonnull public static java.util.List<java.lang.String> allTypeNames()
For printing useful error messages, the proctor webapp, and for testing.- Returns:
- all types name
-
isArrayType
public boolean isArrayType()
-
-