Enum RgxGenOption
- java.lang.Object
-
- java.lang.Enum<RgxGenOption>
-
- com.github.curiousoddman.rgxgen.config.RgxGenOption
-
- All Implemented Interfaces:
Serializable,Comparable<RgxGenOption>
public enum RgxGenOption extends Enum<RgxGenOption>
Enum of keys for available configuration options.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CASE_INSENSITIVEFlag to use case insensitive matching.INFINITE_PATTERN_REPETITIONFor infinite patterns, such asa+,a*anda{n,}, defines limit for the repetitions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBooleanFromProperties(RgxGenProperties properties)Convenience method.StringgetDefault()Get default value associated with the optionStringgetFromProperties(RgxGenProperties properties)Get value from the properties object.intgetIntFromProperties(RgxGenProperties properties)Convenience method.StringgetKey()Get unique identifier of the property<T> voidsetInProperties(RgxGenProperties properties, T value)Associatesvaluefor this option in the propertiesStringtoString()static RgxGenOptionvalueOf(String name)Returns the enum constant of this type with the specified name.static RgxGenOption[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INFINITE_PATTERN_REPETITION
public static final RgxGenOption INFINITE_PATTERN_REPETITION
For infinite patterns, such asa+,a*anda{n,}, defines limit for the repetitions.- Default Value:
- 100
-
CASE_INSENSITIVE
public static final RgxGenOption CASE_INSENSITIVE
Flag to use case insensitive matching.- Default Value:
- false
-
-
Method Detail
-
values
public static RgxGenOption[] 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 (RgxGenOption c : RgxGenOption.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RgxGenOption 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
-
getKey
public String getKey()
Get unique identifier of the property- Returns:
- unique key
-
getDefault
public String getDefault()
Get default value associated with the option- Returns:
- default value
-
getFromProperties
public String getFromProperties(RgxGenProperties properties)
Get value from the properties object.- Parameters:
properties- object to get value from- Returns:
- value from properties, if present. Default otherwise.
-
setInProperties
public <T> void setInProperties(RgxGenProperties properties, T value)
Associatesvaluefor this option in the properties- Type Parameters:
T- type of value- Parameters:
properties- properties to add tovalue- a value
-
getIntFromProperties
public int getIntFromProperties(RgxGenProperties properties)
Convenience method. Returns value of the property transformed to an integer- Parameters:
properties- properties to get value from- Returns:
- integer value associated with property, or default.
-
getBooleanFromProperties
public boolean getBooleanFromProperties(RgxGenProperties properties)
Convenience method. Returns value of the property transformed to an integer- Parameters:
properties- properties to get value from- Returns:
- boolean value associated with property, or default.
-
toString
public String toString()
- Overrides:
toStringin classEnum<RgxGenOption>
-
-