Package org.corpus_tools.pepper.modules
Class PepperModuleProperties
- java.lang.Object
-
- org.corpus_tools.pepper.modules.PepperModuleProperties
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DOTManipulatorProperties,SaltValidatorProperties
public class PepperModuleProperties extends Object implements Serializable
This class is a container for a set ofPepperModulePropertyobjects. This class also offers some methods for accessing and maintaining the objects.- Author:
- Florian Zipser
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,PepperModuleProperty<?>>pepperModulePropertiesInternal map to map allPepperModulePropertyobjects to their name.static StringPROP_AFTER_ADD_SLAYERstatic StringPROP_AFTER_COPY_RESstatic StringPROP_AFTER_REMOVE_ANNOTATIONSstatic StringPROP_AFTER_RENAME_ANNOTATIONSstatic StringPROP_AFTER_REPORT_CORPUSGRAPHstatic StringPROP_AFTER_TOKENIZEstatic StringPROP_BEFORE_ADD_SLAYERstatic StringPROP_BEFORE_READ_META
-
Constructor Summary
Constructors Constructor Description PepperModuleProperties()Creates instance ofPepperModulePropertiesand initializes it with a set of customization properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProperties(org.eclipse.emf.common.util.URI propURI)Loads the given file viaProperties.load(java.io.InputStream)and adds all properties given in the passedPropertyobject.voidaddProperty(PepperModuleProperty<?> property)Adds the givenPepperModulePropertyobject to the internal list.booleancheckProperties()Checks if all properties marked as required are really set.booleancheckProperty(PepperModuleProperty<?> prop)Checks if the value of given property, when marked as required is really set.PropertiesgetProperties()Returns a newPropertiesobject containing all property names and their values.PepperModuleProperty<?>getProperty(String propName)Returns aPepperModulePropertyobject corresponding to the given property name.Collection<PepperModuleProperty<?>>getPropertyDesctriptions()Returns all registeredPepperModulePropertyobjects, which are usable for the correspondingPepperModule.Collection<String>getPropertyNames()Returns all property names registered in that object, and therefore usable for the correspondingPepperModule.voidremovePropertyValue(String propName)Removes the value of the property with the passed property name from the properties.<T> voidsetPropertyValue(String propName, T propValue)Searches for aPepperModulePropertyobject in registeredPepperModulePropertyobjects and sets its value attribute, if aPepperModulePropertyobject was found.voidsetPropertyValues(File propFile)Loads the given file viaProperties.load(java.io.InputStream)and adds all properties given in the passedPropertyobject.voidsetPropertyValues(Properties properties)Adds all properties given in the passedPropertyobject.List<Character>stringToCharList(String input)Expects a list of characters encoded as a String.StringtoString()
-
-
-
Field Detail
-
PROP_AFTER_ADD_SLAYER
public static final String PROP_AFTER_ADD_SLAYER
- See Also:
- Constant Field Values
-
PROP_AFTER_COPY_RES
public static final String PROP_AFTER_COPY_RES
- See Also:
- Constant Field Values
-
PROP_BEFORE_ADD_SLAYER
public static final String PROP_BEFORE_ADD_SLAYER
- See Also:
- Constant Field Values
-
PROP_BEFORE_READ_META
public static final String PROP_BEFORE_READ_META
- See Also:
- Constant Field Values
-
PROP_AFTER_REPORT_CORPUSGRAPH
public static final String PROP_AFTER_REPORT_CORPUSGRAPH
- See Also:
- Constant Field Values
-
PROP_AFTER_RENAME_ANNOTATIONS
public static final String PROP_AFTER_RENAME_ANNOTATIONS
- See Also:
- Constant Field Values
-
PROP_AFTER_REMOVE_ANNOTATIONS
public static final String PROP_AFTER_REMOVE_ANNOTATIONS
- See Also:
- Constant Field Values
-
PROP_AFTER_TOKENIZE
public static final String PROP_AFTER_TOKENIZE
- See Also:
- Constant Field Values
-
pepperModuleProperties
protected Map<String,PepperModuleProperty<?>> pepperModuleProperties
Internal map to map allPepperModulePropertyobjects to their name.
-
-
Constructor Detail
-
PepperModuleProperties
public PepperModuleProperties()
Creates instance ofPepperModulePropertiesand initializes it with a set of customization properties. These properties are:
-
-
Method Detail
-
addProperties
public void addProperties(org.eclipse.emf.common.util.URI propURI)
Loads the given file viaProperties.load(java.io.InputStream)and adds all properties given in the passedPropertyobject. That means, the correspondingPepperModulePropertywill be searched and its value will be set to the one found in the passedPropertiesobject. If no correspondingPepperModulePropertiesobject corresponds to one of the properties contained in the passedPropertyobject, a new one will be created.
-
getProperties
public Properties getProperties()
Returns a newPropertiesobject containing all property names and their values.- Returns:
- new
Propertiesobject
-
setPropertyValues
public void setPropertyValues(File propFile)
Loads the given file viaProperties.load(java.io.InputStream)and adds all properties given in the passedPropertyobject. That means, the correspondingPepperModulePropertywill be searched and its value will be set to the one found in the passedPropertiesobject. If no correspondingPepperModulePropertiesobject corresponds to one of the properties contained in the passedPropertyobject, a new one will be created.
-
setPropertyValues
public void setPropertyValues(Properties properties)
Adds all properties given in the passedPropertyobject. That means, the correspondingPepperModulePropertywill be searched and its value will be set to the one found in the passedPropertiesobject. If no correspondingPepperModulePropertiesobject corresponds to one of the properties contained in the passedPropertyobject, a new one will be created.
-
setPropertyValue
public <T> void setPropertyValue(String propName, T propValue)
Searches for aPepperModulePropertyobject in registeredPepperModulePropertyobjects and sets its value attribute, if aPepperModulePropertyobject was found.- Parameters:
propName- name of property to search forpropValue- value to whichPepperModulePropertys value attribute is set to
-
checkProperties
public boolean checkProperties()
Checks if all properties marked as required are really set. Throws aPepperModulePropertyExceptionif a required value is not set.
-
checkProperty
public boolean checkProperty(PepperModuleProperty<?> prop)
Checks if the value of given property, when marked as required is really set. Throws aPepperModulePropertyExceptionif a required value is not set.
-
addProperty
public void addProperty(PepperModuleProperty<?> property)
Adds the givenPepperModulePropertyobject to the internal list.- Parameters:
property-
-
getProperty
public PepperModuleProperty<?> getProperty(String propName)
Returns aPepperModulePropertyobject corresponding to the given property name.- Parameters:
propName- name of the property- Returns:
PepperModulePropertyobject
-
getPropertyNames
public Collection<String> getPropertyNames()
Returns all property names registered in that object, and therefore usable for the correspondingPepperModule.- Returns:
-
getPropertyDesctriptions
public Collection<PepperModuleProperty<?>> getPropertyDesctriptions()
Returns all registeredPepperModulePropertyobjects, which are usable for the correspondingPepperModule.- Returns:
-
removePropertyValue
public void removePropertyValue(String propName)
Removes the value of the property with the passed property name from the properties.- Parameters:
propName- name of the property to be removed
-
stringToCharList
public List<Character> stringToCharList(String input)
Expects a list of characters encoded as a String. The String is split and returned as a list of characters. The list must be build like this:
LIST: ITEM (,ITEM)*
ITEM: 'CHARACTER'
For instance the passed String "'a', 'b', 'c'" is returned as a list containing 'a', 'b' and 'c'. In case of the characters "'" or "\" are used as items, they must be escaped as "\'" or "\\".- Returns:
- the isToTokenize
-
-