T
- The type of option values.public class OptionKey<T> extends Object implements Serializable
Defined in the sis-utility module
Modifier and Type | Field and Description |
---|---|
static OptionKey<ByteBuffer> |
BYTE_BUFFER
The byte buffer to use for input/output operations.
|
static OptionKey<String> |
URL_ENCODING
The encoding of a URL (not the encoding of the document content).
|
Modifier | Constructor and Description |
---|---|
protected |
OptionKey(String name,
Class<T> type)
Creates a new key of the given name for values of the given type.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object)
Returns
true if the given object is an instance of the same class having the same name and type. |
Class<T> |
getElementType()
Returns the type of values associated to this option key.
|
String |
getName()
Returns the name of this option key.
|
T |
getValueFrom(Map<OptionKey<?>,?> options)
Returns the option value in the given map for this key, or
null if none. |
int |
hashCode()
Returns a hash code value for this object.
|
Map<OptionKey<?>,Object> |
setValueInto(Map<OptionKey<?>,Object> options,
T value)
Sets a value for this option key in the given map, or in a new map if the given map is
null . |
String |
toString()
Returns a string representation of this option key.
|
public static final OptionKey<String> URL_ENCODING
String
or a URL
to a URI
or a File
:
Example: Given the "file:Map%20with%20spaces.png"
URL, then:
"UTF-8"
or "ISO-8859-1"
, then:"file:Map%20with%20spaces.png"
;"file:Map with spaces.png"
.null
or is not provided, then:"file:Map%2520with%2520spaces.png"
,
i.e. the percent sign will be encoded as "%25"
;"file:Map%20with%20spaces.png"
.URLDecoder
public static final OptionKey<ByteBuffer> BYTE_BUFFER
DataStore
implementations allow a byte buffer to be specified, thus allowing users to choose the buffer
capacity, whether the buffer is direct, or to recycle existing buffers.
It is user's responsibility to ensure that:
DataStore
instances.public String getName()
public final Class<T> getElementType()
public T getValueFrom(Map<OptionKey<?>,?> options)
null
if none.
This is a convenience method for implementors, which can be used as below:
public <T> T getOption(final OptionKey<T> key) { ArgumentChecks.ensureNonNull("key", key); return key.getValueFrom(options); }
options
- The map where to search for the value, or null
if not yet created.null
if none.public Map<OptionKey<?>,Object> setValueInto(Map<OptionKey<?>,Object> options, T value)
null
.
This is a convenience method for implementors, which can be used as below:
public <T> void setOption(final OptionKey<T> key, final T value) { ArgumentChecks.ensureNonNull("key", key); options = key.setValueInto(options, value); }
options
- The map where to set the value, or null
if not yet created.value
- The new value for the given option, or null
for removing the value.public boolean equals(Object object)
true
if the given object is an instance of the same class having the same name and type.public int hashCode()
Copyright © 2010–2013 The Apache Software Foundation. All rights reserved.