Package digilib.util
Class Parameter
- java.lang.Object
-
- digilib.util.Parameter
-
public class Parameter extends Object
General digilib parameter class.- Author:
- casties
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getAsBoolean()
Get the value as boolean.File
getAsFile()
Get the value as File.float
getAsFloat()
Get the value as float.int
getAsInt()
Get the value as Object.String
getAsString()
Get the value as String.Object
getDefault()
Get the default as Object.String
getName()
int
getType()
Object
getValue()
Get the value as Object.boolean
hasValue()
Is the value set.String[]
parseAsArray(String separator)
Get the value as Strings split using the separator.float[]
parseAsFloatArray(String separator)
Get the value as floats split using the separator.void
setDefault(Object defval)
Set the default.void
setName(String name)
void
setType(int type)
void
setValue(float value)
Set the value.void
setValue(int value)
Set the value.void
setValue(Object value)
Set the value.boolean
setValueFromString(String val)
Try to set the value from a String.
-
-
-
Method Detail
-
hasValue
public boolean hasValue()
Is the value set.- Returns:
- if the value is set
-
setValueFromString
public boolean setValueFromString(String val)
Try to set the value from a String. Tries to convert the String to the same type as the default value. Sets the value anyway if the default is null. Returns if the value could be set.- Parameters:
val
- the value- Returns:
- if the value was set
-
getDefault
public Object getDefault()
Get the default as Object.- Returns:
- the default
-
setDefault
public void setDefault(Object defval)
Set the default.- Parameters:
defval
- the default
-
getValue
public Object getValue()
Get the value as Object. Returns the default if the value is not set.- Returns:
- the value
-
getAsInt
public int getAsInt()
Get the value as Object. Returns the default if the value is not set.- Returns:
- the value
-
getAsFloat
public float getAsFloat()
Get the value as float. Returns the default if the value is not set.- Returns:
- the value
-
getAsString
public String getAsString()
Get the value as String. Returns the default if the value is not set.- Returns:
- the value
-
getAsBoolean
public boolean getAsBoolean()
Get the value as boolean. Returns the default if the value is not set.- Returns:
- the value
-
getAsFile
public File getAsFile()
Get the value as File. Returns the default if the value is not set.- Returns:
- the value
-
parseAsArray
public String[] parseAsArray(String separator)
Get the value as Strings split using the separator.- Parameters:
separator
- the separator- Returns:
- the strings
-
parseAsFloatArray
public float[] parseAsFloatArray(String separator)
Get the value as floats split using the separator.- Parameters:
separator
- the separator- Returns:
- the floats
-
setValue
public void setValue(Object value)
Set the value.- Parameters:
value
- the value
-
setValue
public void setValue(int value)
Set the value.- Parameters:
value
- the value
-
setValue
public void setValue(float value)
Set the value.- Parameters:
value
- the value
-
getName
public String getName()
- Returns:
- the name
-
setName
public void setName(String name)
- Parameters:
name
- the name
-
getType
public int getType()
- Returns:
- the type
-
setType
public void setType(int type)
- Parameters:
type
- the type
-
-