Package adams.core.option
Class Conversion
- java.lang.Object
-
- adams.core.option.Conversion
-
public class Conversion extends Object
Helper class that converts classnames from options on the fly into the most up-to-date format.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILENAMEthe name of the props file.static StringKEY_PARTIAL_RENAMEthe key that lists the partial renaming keys.static StringKEY_RENAMEthe key that lists the classname mapping keys.static StringKEY_RENAME_OPTIONthe key that lists the keys for option renaming.static StringKEY_RENAME_PROPERTYthe key that lists the keys for property renaming.protected HashMap<String,String>m_Mappingthe mapping (exact classname replacement).protected HashMap<String,HashMap<String,String>>m_MappingOptionthe mapping (option renaming: class - [-old, -new]).protected HashMap<String,String>m_MappingPartialthe mapping (partial renaming).protected List<String>m_MappingPartialOrderthe partial mapping order.protected HashMap<String,HashMap<String,String>>m_MappingPropertythe mapping (property renaming: class - [oldProp, newProp]).protected Propertiesm_Propertiesthe properties.protected static Conversionm_Singletonthe singleton.
-
Constructor Summary
Constructors Modifier Constructor Description protectedConversion()Initializes the conversions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PropertiesgetProperties()Returns the properties that define the editor.static ConversiongetSingleton()Returns the singleton.protected voidinitMappings()Initializes the mapping.Stringrename(String classname)Renames a classname if necessary.StringrenameOption(String classname, String option)Renames an option (eg -blah to -bloerk) if necessary.StringrenameProperty(String classname, String property)Renames a property (eg blahProp to bloerkProp) if necessary.
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the name of the props file.- See Also:
- Constant Field Values
-
KEY_RENAME
public static final String KEY_RENAME
the key that lists the classname mapping keys.- See Also:
- Constant Field Values
-
KEY_PARTIAL_RENAME
public static final String KEY_PARTIAL_RENAME
the key that lists the partial renaming keys.- See Also:
- Constant Field Values
-
KEY_RENAME_OPTION
public static final String KEY_RENAME_OPTION
the key that lists the keys for option renaming.- See Also:
- Constant Field Values
-
KEY_RENAME_PROPERTY
public static final String KEY_RENAME_PROPERTY
the key that lists the keys for property renaming.- See Also:
- Constant Field Values
-
m_Properties
protected Properties m_Properties
the properties.
-
m_MappingOption
protected HashMap<String,HashMap<String,String>> m_MappingOption
the mapping (option renaming: class - [-old, -new]).
-
m_MappingProperty
protected HashMap<String,HashMap<String,String>> m_MappingProperty
the mapping (property renaming: class - [oldProp, newProp]).
-
m_Singleton
protected static Conversion m_Singleton
the singleton.
-
-
Method Detail
-
getProperties
protected Properties getProperties()
Returns the properties that define the editor.- Returns:
- the properties
-
initMappings
protected void initMappings()
Initializes the mapping.
-
rename
public String rename(String classname)
Renames a classname if necessary.- Parameters:
classname- the classname to process- Returns:
- the potentially updated classname
-
renameOption
public String renameOption(String classname, String option)
Renames an option (eg -blah to -bloerk) if necessary.- Parameters:
classname- the classname to processoption- the option to process (with or without leading dash)- Returns:
- the potentially updated option
-
renameProperty
public String renameProperty(String classname, String property)
Renames a property (eg blahProp to bloerkProp) if necessary.- Parameters:
classname- the classname to processproperty- the property to process- Returns:
- the potentially updated option
-
getSingleton
public static Conversion getSingleton()
Returns the singleton.- Returns:
- the singleton
-
-