Package adams.data.conversion
Class Quote
-
- All Implemented Interfaces:
AdditionalInformationHandler,ClassCrossReference,CleanUpHandler,CrossReference,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<AbstractConversion>,SizeOfHandler,Stoppable,Conversion,ConversionFromString,ConversionToString,Serializable
public class Quote extends AbstractStringConversion implements ClassCrossReference
Surrounds a string with quotes (single or double), if necessary due to blanks or other characters (new line, tab) in the string.
However, you can also 'force' the quoting.
See also:
adams.data.conversion.UnQuote
adams.data.conversion.BackQuote
adams.data.conversion.UnBackQuote
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-quote-type <SINGLE|DOUBLE|DOUBLE_UP> (property: quoteType) The type of quote to use. default: DOUBLE
-double-up <boolean> (property: doubleUp) If enabled, internal quotes get doubled up rather than escaped with backslashes. default: false
-force <boolean> (property: force) If enabled, forces the quoting of the string. default: false
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQuote.QuoteTypeThe type of quote.
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_DoubleUpwhether to double up internal quotes rather than escaping them with backslashes.protected booleanm_Forcewhether to enforce quoting.protected Quote.QuoteTypem_QuoteTypethe quote type to use.-
Fields inherited from class adams.data.conversion.AbstractConversion
m_Input, m_Output, m_Owner, m_Stopped
-
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 Quote()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.protected ObjectdoConvert()Performs the actual conversion.StringdoubleUpTipText()Returns the tip text for this property.StringforceTipText()Returns the tip text for this property.Class[]getClassCrossReferences()Returns the cross-referenced classes.booleangetDoubleUp()Returns whether to double up internal quotes rather than escaping with backslash.booleangetForce()Returns whether to force quoting.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.Quote.QuoteTypegetQuoteType()Returns the type of quote to use.StringglobalInfo()Returns a string describing the object.StringquoteTypeTipText()Returns the tip text for this property.voidsetDoubleUp(boolean value)Sets whether to double up internal quotes rather than escaping with backslash.voidsetForce(boolean value)Sets whether to force quoting.voidsetQuoteType(Quote.QuoteType value)Sets the type of quote to use.-
Methods inherited from class adams.data.conversion.AbstractStringConversion
accepts, generates
-
Methods inherited from class adams.data.conversion.AbstractConversion
checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, reset, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
-
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.CleanUpHandler
cleanUp
-
Methods inherited from interface adams.data.conversion.Conversion
convert, getInput, getInput, getOutput, getOutput, getOwner, setInput, setOwner
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.Stoppable
stopExecution
-
-
-
-
Field Detail
-
m_QuoteType
protected Quote.QuoteType m_QuoteType
the quote type to use.
-
m_DoubleUp
protected boolean m_DoubleUp
whether to double up internal quotes rather than escaping them with backslashes.
-
m_Force
protected boolean m_Force
whether to enforce quoting.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
getClassCrossReferences
public Class[] getClassCrossReferences()
Returns the cross-referenced classes.- Specified by:
getClassCrossReferencesin interfaceClassCrossReference- Returns:
- the classes
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setQuoteType
public void setQuoteType(Quote.QuoteType value)
Sets the type of quote to use.- Parameters:
value- the type
-
getQuoteType
public Quote.QuoteType getQuoteType()
Returns the type of quote to use.- Returns:
- the type
-
quoteTypeTipText
public String quoteTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setDoubleUp
public void setDoubleUp(boolean value)
Sets whether to double up internal quotes rather than escaping with backslash.- Parameters:
value- true if to double up
-
getDoubleUp
public boolean getDoubleUp()
Returns whether to double up internal quotes rather than escaping with backslash.- Returns:
- true if to double up
-
doubleUpTipText
public String doubleUpTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setForce
public void setForce(boolean value)
Sets whether to force quoting.- Parameters:
value- true if to force quoting
-
getForce
public boolean getForce()
Returns whether to force quoting.- Returns:
- true if to force quoting
-
forceTipText
public String forceTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractConversion- Returns:
- null if no info available, otherwise short string
-
doConvert
protected Object doConvert() throws Exception
Performs the actual conversion.- Specified by:
doConvertin classAbstractConversion- Returns:
- the converted data
- Throws:
Exception- if something goes wrong with the conversion
-
-