Package com.norconex.commons.lang.map
Enum PropertySetter
- java.lang.Object
-
- java.lang.Enum<PropertySetter>
-
- com.norconex.commons.lang.map.PropertySetter
-
- All Implemented Interfaces:
Serializable,Comparable<PropertySetter>
public enum PropertySetter extends Enum<PropertySetter>
Convenient way of handling the different ways a value (or values) can be set on a
Propertiesinstance.XML configuration usage:
onSet="[append|prepend|replace|optional]"The above is the recommended attribute for consuming classes to use in XML configuration.
- Since:
- 2.0.0
- Author:
- Pascal Essiembre
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(Properties properties, String key, Object value)static PropertySetterfrom(String name)static PropertySetterfrom(String name, PropertySetter defaultSetter)static PropertySetterfromXML(XML xml, PropertySetter defaultValue)static PropertySetterorAppend(PropertySetter setter)static PropertySetterorOptional(PropertySetter setter)static PropertySetterorPrepend(PropertySetter setter)static PropertySetterorReplace(PropertySetter setter)static voidtoXML(XML xml, PropertySetter setter)static PropertySettervalueOf(String name)Returns the enum constant of this type with the specified name.static PropertySetter[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
APPEND
public static final PropertySetter APPEND
-
PREPEND
public static final PropertySetter PREPEND
-
REPLACE
public static final PropertySetter REPLACE
-
OPTIONAL
public static final PropertySetter OPTIONAL
-
-
Method Detail
-
values
public static PropertySetter[] 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 (PropertySetter c : PropertySetter.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PropertySetter 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
-
apply
public void apply(Properties properties, String key, Object value)
-
from
public static PropertySetter from(String name, PropertySetter defaultSetter)
-
from
public static PropertySetter from(String name)
-
orAppend
public static PropertySetter orAppend(PropertySetter setter)
-
orOptional
public static PropertySetter orOptional(PropertySetter setter)
-
orPrepend
public static PropertySetter orPrepend(PropertySetter setter)
-
orReplace
public static PropertySetter orReplace(PropertySetter setter)
-
fromXML
public static PropertySetter fromXML(XML xml, PropertySetter defaultValue)
-
toXML
public static void toXML(XML xml, PropertySetter setter)
-
-