@Immutable public class BinaryStoreValueFactory extends AbstractValueFactory<BinaryValue> implements BinaryFactory
BinaryFactory
implementation that contains many general methods that are likely to be appropriate for many
concrete implementations.AbstractValueFactory.ConvertingIterator<ValueType>
decoder, propertyType, valueFactories
DEFAULT_DECODER, DEFAULT_ENCODER
Constructor and Description |
---|
BinaryStoreValueFactory(BinaryStore store,
TextDecoder decoder,
ValueFactories factories,
ValueFactory<String> stringFactory)
Create a factory instance that finds persisted binary values in the supplied store, and that uses the supplied decoder and
string value factory to convert string values into binary values.
|
Modifier and Type | Method and Description |
---|---|
BinaryValue |
create(BigDecimal value)
Create a value from a decimal.
|
BinaryValue |
create(BinaryValue value)
Create a value from the binary content given by the supplied stream.
|
BinaryValue |
create(boolean value)
Create a boolean from a string.
|
BinaryValue |
create(byte[] value)
Create a value from the binary content given by the supplied array.
|
BinaryValue |
create(Calendar value)
Create a value from a Calendar instance.
|
BinaryValue |
create(Date value)
Create a value from a date.
|
BinaryValue |
create(DateTime value)
Create a value from a date-time instant.
|
BinaryValue |
create(double value)
Create a value from a double.
|
BinaryValue |
create(float value)
Create a value from a float.
|
BinaryValue |
create(InputStream stream)
Create a value from the binary content given by the supplied stream.
|
BinaryValue |
create(InputStream stream,
String hint)
Create a value from the binary content given by the supplied stream with a hint to the BinaryStore for how to store it
|
BinaryValue |
create(int value)
Create a value from an integer.
|
BinaryValue |
create(long value)
Create a long from a string.
|
BinaryValue |
create(Name value)
Create a value from a name.
|
BinaryValue |
create(NodeKey value)
Create a value from a
NodeKey . |
BinaryValue |
create(Path.Segment value)
Create a value from a path segment.
|
BinaryValue |
create(Path value)
Create a value from a path.
|
BinaryValue |
create(Reference value)
Create a value from a reference.
|
BinaryValue |
create(String value)
Create a value from a string, using no decoding.
|
BinaryValue |
create(String value,
TextDecoder decoder)
Create a value from a string, using the supplied decoder.
|
BinaryValue |
create(URI value)
Create a value from a URI.
|
BinaryValue |
create(UUID value)
Create a value from a UUID.
|
BinaryValue[] |
createEmptyArray(int length)
Creates an empty array of the given type.
|
BinaryValue |
find(BinaryKey secureHash,
long size)
Find an existing binary value given the supplied binary key.
|
protected ValueFactory<String> |
getStringValueFactory() |
BinaryStoreValueFactory |
with(BinaryStore store)
Return a potentially new copy of this factory that uses the supplied
BinaryStore object. |
BinaryFactory |
with(ValueFactories valueFactories)
Return a potentially new copy of this factory that uses the supplied ValueFactories object.
|
create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, getDecoder, getDecoder, getPropertyType
public BinaryStoreValueFactory(BinaryStore store, TextDecoder decoder, ValueFactories factories, ValueFactory<String> stringFactory)
store
- the binary store; may not be nulldecoder
- the text decoder; may be null if the default decoder should be usedfactories
- the set of value factories, used to obtain the string value
factory
; may not be nullstringFactory
- the optional string factory that should be used in place of the one in the supplied ValueFactories
parameter; may be nullpublic BinaryFactory with(ValueFactories valueFactories)
ValueFactory
with
in interface BinaryFactory
with
in interface ValueFactory<BinaryValue>
valueFactories
- the value factories object; may not be nullpublic BinaryStoreValueFactory with(BinaryStore store)
BinaryFactory
BinaryStore
object.with
in interface BinaryFactory
store
- the binary store; may not be nullprotected ValueFactory<String> getStringValueFactory()
getStringValueFactory
in class AbstractValueFactory<BinaryValue>
public BinaryValue[] createEmptyArray(int length)
ValueFactory
createEmptyArray
in interface ValueFactory<BinaryValue>
length
- the length of the array; must be a positive valuepublic BinaryValue create(String value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the string from which the value is to be createdValueFactory.create(String, TextDecoder)
public BinaryValue create(String value, TextDecoder decoder)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the string from which the value is to be createddecoder
- the decoder that should be used; if null, the default decoder
is usedValueFactory.create(String)
public BinaryValue create(int value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the integer from which the value is to be createdpublic BinaryValue create(long value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the string from which the long is to be createdpublic BinaryValue create(boolean value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the boolean from which the value is to be createdpublic BinaryValue create(float value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the float from which the value is to be createdpublic BinaryValue create(double value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the double from which the value is to be createdpublic BinaryValue create(BigDecimal value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the decimal from which the value is to be createdpublic BinaryValue create(Calendar value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the Calendar instance from which the value is to be createdpublic BinaryValue create(Date value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the date from which the value is to be createdpublic BinaryValue create(DateTime value) throws ValueFormatException
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the date-time instant from which the value is to be createdValueFormatException
- if the conversion from a Date could not be performedpublic BinaryValue create(Name value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the name from which the value is to be createdpublic BinaryValue create(Path value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the path from which the value is to be createdpublic BinaryValue create(Path.Segment value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the path segment from which the value is to be createdpublic BinaryValue create(Reference value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the reference from which the value is to be createdpublic BinaryValue create(URI value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the URI from which the value is to be createdpublic BinaryValue create(UUID value)
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the UUID from which the value is to be createdpublic BinaryValue create(NodeKey value) throws ValueFormatException
ValueFactory
NodeKey
.create
in interface ValueFactory<BinaryValue>
value
- the node key from which the value is to be createdValueFormatException
- if the conversion from a NodeKey could not be performedpublic BinaryValue create(BinaryValue value) throws ValueFormatException, IoException
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the binary object to be used to create the valueValueFormatException
- if the conversion from the binary object could not be performedIoException
- If an unexpected problem occurs while accessing the supplied binary value (such as an
IOException
).public BinaryValue create(byte[] value) throws ValueFormatException
ValueFactory
create
in interface ValueFactory<BinaryValue>
value
- the content to be used to create the valueValueFormatException
- if the conversion from a byte array could not be performedpublic BinaryValue create(InputStream stream) throws IoException
ValueFactory
create
in interface ValueFactory<BinaryValue>
stream
- the stream containing the content to be used to create the valueIoException
- If an unexpected problem occurs while accessing the supplied stream (such as an IOException
).public BinaryValue create(InputStream stream, String hint) throws IoException
ValueFactory
create
in interface ValueFactory<BinaryValue>
create
in class AbstractValueFactory<BinaryValue>
stream
- the stream containing the content to be used to create the valuehint
- a hint that the BinaryStore may use to make storage decisions about this input streamIoException
- If an unexpected problem occurs while accessing the supplied stream (such as an IOException
).public BinaryValue find(BinaryKey secureHash, long size) throws BinaryStoreException
BinaryFactory
find
in interface BinaryFactory
secureHash
- the secure hash of the binary content, which was probably obtained
from
a previously-held BinaryValue
object; a null or empty value is allowed, but will always result in returning
nullsize
- the size of the binary contentBinaryStoreException
- if there is a problem accessing the binary storeCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.