public class DynamicMetadataOptions extends java.lang.Object implements MetadataOptions
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
LOGGER |
static MetadataLevel |
METADATA_LEVEL_DEFAULT |
static java.lang.String |
METADATA_LEVEL_KEY |
private java.util.Properties |
props |
static boolean |
READER_VALIDATE_DEFAULT |
static java.lang.String |
READER_VALIDATE_KEY |
Constructor and Description |
---|
DynamicMetadataOptions()
Creates an options object with metadata level set to
METADATA_LEVEL_DEFAULT and file validation set to READER_VALIDATE_DEFAULT . |
DynamicMetadataOptions(MetadataLevel level)
Creates an options object with metadata level set to the
specified value and file validation set to
READER_VALIDATE_DEFAULT |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
get(java.lang.String name)
Get the value of property
name . |
java.lang.String |
get(java.lang.String name,
java.lang.String defaultValue)
Get the value of property
name . |
java.lang.Boolean |
getBoolean(java.lang.String name)
Get the value of property
name as a Boolean. |
java.lang.Boolean |
getBoolean(java.lang.String name,
java.lang.Boolean defaultValue)
Get the value of property
name as a Boolean. |
java.lang.Class<?> |
getClass(java.lang.String name)
Get the value of property
name as a class. |
java.lang.Class<?> |
getClass(java.lang.String name,
java.lang.Class<?> defaultValue)
Get the value of property
name as a class. |
java.lang.Double |
getDouble(java.lang.String name)
Get the value of property
name as a Double. |
java.lang.Double |
getDouble(java.lang.String name,
java.lang.Double defaultValue)
Get the value of property
name as a Double. |
<T extends java.lang.Enum<T>> |
getEnum(java.lang.String name,
T defaultValue)
Get the value of property
name as an enumerated type. |
java.io.File |
getFile(java.lang.String name)
Get the value of property
name as a file object. |
java.io.File |
getFile(java.lang.String name,
java.io.File defaultValue)
Get the value of property
name as a file object. |
java.lang.Float |
getFloat(java.lang.String name)
Get the value of property
name as a Float. |
java.lang.Float |
getFloat(java.lang.String name,
java.lang.Float defaultValue)
Get the value of property
name as a Float. |
java.lang.Integer |
getInteger(java.lang.String name)
Get the value of property
name as an Integer. |
java.lang.Integer |
getInteger(java.lang.String name,
java.lang.Integer defaultValue)
Get the value of property
name as an Integer. |
java.lang.Long |
getLong(java.lang.String name)
Get the value of property
name as a Long. |
java.lang.Long |
getLong(java.lang.String name,
java.lang.Long defaultValue)
Get the value of property
name as a Long. |
MetadataLevel |
getMetadataLevel()
Get the configured metadata level.
|
static java.lang.String |
getMetadataOptionsFile(java.lang.String id) |
boolean |
isValidate()
Checks whether file validation has been set.
|
void |
loadOptions(java.lang.String optionsFile,
java.util.ArrayList<java.lang.String> availableOptionKeys) |
void |
set(java.lang.String name,
java.lang.String value)
Set property
name to value . |
void |
setBoolean(java.lang.String name,
java.lang.Boolean value)
Set property
name to Boolean value . |
void |
setClass(java.lang.String name,
java.lang.Class<?> value)
Set property
name to Class value . |
void |
setDouble(java.lang.String name,
java.lang.Double value)
Set property
name to Double value . |
<T extends java.lang.Enum<T>> |
setEnum(java.lang.String name,
T value)
Set property
name to enumerated type value . |
void |
setFile(java.lang.String name,
java.io.File value)
Set property
name to file object value . |
void |
setFloat(java.lang.String name,
java.lang.Float value)
Set property
name to Float value . |
void |
setInteger(java.lang.String name,
java.lang.Integer value)
Set property
name to Integer value . |
void |
setLong(java.lang.String name,
java.lang.Long value)
Set property
name to Long value . |
void |
setMetadataLevel(MetadataLevel level)
Set the metadata level.
|
void |
setValidate(boolean validateMetadata)
Specifies whether or not to validate files when reading.
|
protected static final org.slf4j.Logger LOGGER
public static final java.lang.String METADATA_LEVEL_KEY
public static final MetadataLevel METADATA_LEVEL_DEFAULT
public static final java.lang.String READER_VALIDATE_KEY
public static final boolean READER_VALIDATE_DEFAULT
private java.util.Properties props
public DynamicMetadataOptions()
METADATA_LEVEL_DEFAULT
and file validation set to READER_VALIDATE_DEFAULT
.public DynamicMetadataOptions(MetadataLevel level)
READER_VALIDATE_DEFAULT
level
- the MetadataLevel
to use.public MetadataLevel getMetadataLevel()
MetadataOptions
getMetadataLevel
in interface MetadataOptions
MetadataLevel
.public void setMetadataLevel(MetadataLevel level)
MetadataOptions
setMetadataLevel
in interface MetadataOptions
level
- a MetadataLevel
.public boolean isValidate()
MetadataOptions
isValidate
in interface MetadataOptions
true
if files are validated when read, false
otherwise.public void setValidate(boolean validateMetadata)
MetadataOptions
setValidate
in interface MetadataOptions
validateMetadata
- true
if files should be validated, false
otherwise.public void set(java.lang.String name, java.lang.String value)
name
to value
.
If value
is null
the property will be removed.name
- property name.value
- property value.java.lang.IllegalArgumentException
- if name
is null
.public java.lang.String get(java.lang.String name)
name
.name
- property name.null
if the property does not exist.public java.lang.String get(java.lang.String name, java.lang.String defaultValue)
name
.name
- property name.defaultValue
- default value.defaultValue
if the property
does not exist.public <T extends java.lang.Enum<T>> void setEnum(java.lang.String name, T value)
name
to enumerated type value
.name
- property name.value
- property value.public <T extends java.lang.Enum<T>> T getEnum(java.lang.String name, T defaultValue)
name
as an enumerated type.name
- property name.defaultValue
- default value.defaultValue
if the property does not exist.java.lang.IllegalArgumentException
- if mapping is illegal for the type
providedpublic void setBoolean(java.lang.String name, java.lang.Boolean value)
name
to Boolean value
.name
- property name.value
- property value.public java.lang.Boolean getBoolean(java.lang.String name)
name
as a Boolean.name
- property name.null
if the
property does not exist.java.lang.IllegalArgumentException
- if value does not represent a Boolean.public java.lang.Boolean getBoolean(java.lang.String name, java.lang.Boolean defaultValue)
name
as a Boolean.name
- property name.defaultValue
- default value.defaultValue
if
the property does not exist.java.lang.IllegalArgumentException
- if value does not represent a Boolean.public void setInteger(java.lang.String name, java.lang.Integer value)
name
to Integer value
.name
- property name.value
- property value.public java.lang.Integer getInteger(java.lang.String name)
name
as an Integer.name
- property name.null
if the
property does not exist.java.lang.NumberFormatException
- if value does not represent an Integer.public java.lang.Integer getInteger(java.lang.String name, java.lang.Integer defaultValue)
name
as an Integer.name
- property name.defaultValue
- default value.defaultValue
if
the property does not exist.java.lang.NumberFormatException
- if value does not represent an Integer.public void setLong(java.lang.String name, java.lang.Long value)
name
to Long value
.name
- property name.value
- property value.public java.lang.Long getLong(java.lang.String name)
name
as a Long.name
- property name.null
if the property
does not exist.java.lang.NumberFormatException
- if value does not represent a Long.public java.lang.Long getLong(java.lang.String name, java.lang.Long defaultValue)
name
as a Long.name
- property name.defaultValue
- default value.defaultValue
if
the property does not exist.java.lang.NumberFormatException
- if value does not represent a Long.public void setFloat(java.lang.String name, java.lang.Float value)
name
to Float value
.name
- property name.value
- property value.public java.lang.Float getFloat(java.lang.String name)
name
as a Float.name
- property name.null
if the
property does not exist.java.lang.NumberFormatException
- if value does not represent a Float.public java.lang.Float getFloat(java.lang.String name, java.lang.Float defaultValue)
name
as a Float.name
- property name.defaultValue
- default value.defaultValue
if
the property does not exist.java.lang.NumberFormatException
- if value does not represent a Float.public void setDouble(java.lang.String name, java.lang.Double value)
name
to Double value
.name
- property name.value
- property value.public java.lang.Double getDouble(java.lang.String name)
name
as a Double.name
- property name.null
if the
property does not exist.java.lang.NumberFormatException
- if value does not represent a Double.public java.lang.Double getDouble(java.lang.String name, java.lang.Double defaultValue)
name
as a Double.name
- property name.defaultValue
- default value.defaultValue
if
the property does not exist.java.lang.NumberFormatException
- if value does not represent a Double.public void setClass(java.lang.String name, java.lang.Class<?> value)
name
to Class value
.name
- property name.value
- property value.public java.lang.Class<?> getClass(java.lang.String name) throws java.lang.ClassNotFoundException
name
as a class.name
- property name.null
if the
property does not exist.java.lang.ClassNotFoundException
- if value does not map to an existing class.public java.lang.Class<?> getClass(java.lang.String name, java.lang.Class<?> defaultValue) throws java.lang.ClassNotFoundException
name
as a class.name
- property name.defaultValue
- default value.defaultValue
if
the property does not exist.java.lang.ClassNotFoundException
- if value does not map to an existing class.public void setFile(java.lang.String name, java.io.File value)
name
to file object value
.name
- property name.value
- property value.public java.io.File getFile(java.lang.String name)
name
as a file object.name
- property name.File
, or null
if the
property does not exist.public java.io.File getFile(java.lang.String name, java.io.File defaultValue)
name
as a file object.name
- property name.defaultValue
- default value.File
, or defaultValue
if
the property does not exist.public void loadOptions(java.lang.String optionsFile, java.util.ArrayList<java.lang.String> availableOptionKeys) throws java.io.IOException, FormatException
java.io.IOException
FormatException
public static java.lang.String getMetadataOptionsFile(java.lang.String id)
Copyright © 2024 Open Microscopy Environment