Package adams.data.idextraction
Class ReportFieldRegExp
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,IDExtractor
,Serializable
public class ReportFieldRegExp extends ReportField
Returns the value of the specified field after passing it through the find/replace pair.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseRegExp
m_Find
the string to find.protected Pattern
m_FindPattern
the pattern to find.protected boolean
m_RemoveFileExt
whether to remove any file extension before applying the regexp.protected String
m_Replace
the replacement string.-
Fields inherited from class adams.data.idextraction.ReportField
m_Field
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description ReportFieldRegExp()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected String
doExtractID(Object obj)
Extracts the ID from a object.String
findTipText()
Returns the tip text for this property.BaseRegExp
getFind()
Returns the string to find (regular expression).boolean
getRemoveFileExt()
Returns whether to remove any file extension before applying the regular expression.String
getReplace()
Returns the string to replace the occurences with.String
globalInfo()
Returns a string describing the object.boolean
handles(Object obj)
Checks whether the data type is handled.String
removeFileExtTipText()
Returns the tip text for this property.String
replaceTipText()
Returns the tip text for this property.protected void
reset()
Resets the scheme.void
setFind(BaseRegExp value)
Sets the string to find (regular expression).void
setRemoveFileExt(boolean value)
Sets whether to remove any file extension before applying the regular expression.void
setReplace(String value)
Sets the string to replace the occurrences with.-
Methods inherited from class adams.data.idextraction.ReportField
fieldTipText, getField, getQuickInfo, setField
-
Methods inherited from class adams.data.idextraction.AbstractIDExtractor
check, extractID
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Find
protected BaseRegExp m_Find
the string to find.
-
m_Replace
protected String m_Replace
the replacement string.
-
m_RemoveFileExt
protected boolean m_RemoveFileExt
whether to remove any file extension before applying the regexp.
-
m_FindPattern
protected transient Pattern m_FindPattern
the pattern to find.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Overrides:
globalInfo
in classReportField
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classReportField
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractOptionHandler
-
setFind
public void setFind(BaseRegExp value)
Sets the string to find (regular expression).- Parameters:
value
- the string
-
getFind
public BaseRegExp getFind()
Returns the string to find (regular expression).- Returns:
- the string
-
findTipText
public String findTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setReplace
public void setReplace(String value)
Sets the string to replace the occurrences with.- Parameters:
value
- the string
-
getReplace
public String getReplace()
Returns the string to replace the occurences with.- Returns:
- the string
-
replaceTipText
public String replaceTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRemoveFileExt
public void setRemoveFileExt(boolean value)
Sets whether to remove any file extension before applying the regular expression.- Parameters:
value
- true if to remove
-
getRemoveFileExt
public boolean getRemoveFileExt()
Returns whether to remove any file extension before applying the regular expression.- Returns:
- true if to remove
-
removeFileExtTipText
public String removeFileExtTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
handles
public boolean handles(Object obj)
Checks whether the data type is handled.- Specified by:
handles
in interfaceIDExtractor
- Overrides:
handles
in classReportField
- Parameters:
obj
- the object to check- Returns:
- true if handled
-
doExtractID
protected String doExtractID(Object obj)
Extracts the ID from a object.- Overrides:
doExtractID
in classReportField
- Parameters:
obj
- the object to process- Returns:
- the extracted ID, null if failed to extract or not handled
-
-