Package org.corpus_tools.pepper.modules
Class PepperModuleProperty<T>
- java.lang.Object
-
- org.corpus_tools.pepper.modules.PepperModuleProperty<T>
-
- All Implemented Interfaces:
Serializable,Comparable<PepperModuleProperty<?>>
public class PepperModuleProperty<T> extends Object implements Comparable<PepperModuleProperty<?>>, Serializable
With properties, the conversion process done by a Pepper module can be customized. A property in general is an attribute value pair, with a unique name and a value influencing the module's behavior. It is possible to add a default value in case the value was not initialized by the Pepper workflow file. A further flag can be used to set the property as required, which means, the property must be set to run the container module. Each property should contain a description, to help the user understanding how to use this property. A property is created in a fluent way. See the following sample:PepperModuleProperty.create().withName("MyProp").withType(String.class) .withDescription("Please describe the property for the user. ") .withDefaultValue("theDefaultWhenNoValueIsSet").isRequired(false).build();- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPepperModuleProperty.NameBuilder
-
Constructor Summary
Constructors Constructor Description PepperModuleProperty(String name, Class<T> clazz, String description)Deprecated.will be removed with Pepper 4.0PepperModuleProperty(String name, Class<T> clazz, String description, boolean required)Deprecated.will be removed with Pepper 4.0PepperModuleProperty(String name, Class<T> clazz, String description, T defaultValue)Deprecated.will be removed with Pepper 4.0PepperModuleProperty(String name, Class<T> clazz, String description, T defaultValue, boolean required)Deprecated.the visibility of this method will be set to private
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(PepperModuleProperty<?> o)static PepperModuleProperty.NameBuildercreate()booleanequals(Object obj)TgetDefaultValue()StringgetDescription()StringgetName()Class<T>getType()TgetValue()inthashCode()booleanisRequired()voidsetValue(T value)voidsetValueString(String value)Sets the given value to the internal one.StringtoString()
-
-
-
Constructor Detail
-
PepperModuleProperty
@Deprecated public PepperModuleProperty(String name, Class<T> clazz, String description)
Deprecated.will be removed with Pepper 4.0
-
PepperModuleProperty
@Deprecated public PepperModuleProperty(String name, Class<T> clazz, String description, T defaultValue)
Deprecated.will be removed with Pepper 4.0
-
PepperModuleProperty
@Deprecated public PepperModuleProperty(String name, Class<T> clazz, String description, boolean required)
Deprecated.will be removed with Pepper 4.0
-
PepperModuleProperty
@Deprecated public PepperModuleProperty(String name, Class<T> clazz, String description, T defaultValue, boolean required)
Deprecated.the visibility of this method will be set to privateCreates aPepperModulePropertyinstance and sets its values to the given ones.- Parameters:
name- name of the propertyclazz- the propertys classdescription- a description to the propertydefaultValue- sets a default value if no one is setrequired- determines if the property is required (true means property is required)
-
-
Method Detail
-
getName
public String getName()
-
getDescription
public String getDescription()
-
isRequired
public boolean isRequired()
-
setValue
public void setValue(T value)
-
getValue
public T getValue()
-
getDefaultValue
public final T getDefaultValue()
-
setValueString
public void setValueString(String value)
Sets the given value to the internal one. In case of the type of this property is not a String, this method will try to cast the given value. Please note, that only supported types can be casted. The following types are provide by a type cast:- Parameters:
value- consumes the given String parameter and transforms it
-
compareTo
public int compareTo(PepperModuleProperty<?> o)
- Specified by:
compareToin interfaceComparable<T>
-
create
public static PepperModuleProperty.NameBuilder create()
-
-