T - the type of this marshallerV - the type of the mapped scalar marshallerpublic class FunctionalScalarMarshaller<T,V> extends Object implements ProtoStreamMarshaller<T>
ScalarMarshaller.| Constructor and Description |
|---|
FunctionalScalarMarshaller(Class<? extends T> targetClass,
ScalarMarshaller<V> marshaller,
org.wildfly.common.function.ExceptionFunction<T,V,IOException> function,
org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
Constructs a new single field marshaller based on single scalar marshaller.
|
FunctionalScalarMarshaller(Class<? extends T> targetClass,
ScalarMarshaller<V> marshaller,
Supplier<T> defaultFactory,
BiPredicate<V,V> equals,
org.wildfly.common.function.ExceptionFunction<T,V,IOException> function,
org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
Constructs a new single field marshaller based on single scalar marshaller.
|
FunctionalScalarMarshaller(Class<? extends T> targetClass,
ScalarMarshaller<V> marshaller,
Supplier<T> defaultFactory,
org.wildfly.common.function.ExceptionFunction<T,V,IOException> function,
org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
Constructs a new single field marshaller based on single scalar marshaller.
|
FunctionalScalarMarshaller(Class<? extends T> targetClass,
ScalarMarshaller<V> marshaller,
Supplier<T> defaultFactory,
org.wildfly.common.function.ExceptionPredicate<T,IOException> skipWrite,
org.wildfly.common.function.ExceptionFunction<T,V,IOException> function,
org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
Constructs a new single field marshaller based on single scalar marshaller.
|
FunctionalScalarMarshaller(ScalarMarshaller<V> marshaller,
Supplier<T> defaultFactory,
BiPredicate<V,V> equals,
org.wildfly.common.function.ExceptionFunction<T,V,IOException> function,
org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
Constructs a new single field marshaller based on single scalar marshaller.
|
FunctionalScalarMarshaller(ScalarMarshaller<V> marshaller,
Supplier<T> defaultFactory,
org.wildfly.common.function.ExceptionFunction<T,V,IOException> function,
org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
Constructs a new single field marshaller based on single scalar marshaller.
|
FunctionalScalarMarshaller(ScalarMarshaller<V> marshaller,
Supplier<T> defaultFactory,
org.wildfly.common.function.ExceptionPredicate<T,IOException> skipWrite,
org.wildfly.common.function.ExceptionFunction<T,V,IOException> function,
org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
Constructs a new single field marshaller based on single scalar marshaller.
|
| Modifier and Type | Method and Description |
|---|---|
Class<? extends T> |
getJavaClass()
Returns the type of object handled by this marshallable instance.
|
T |
readFrom(ProtoStreamReader reader)
Reads an object from the specified reader.
|
void |
writeTo(ProtoStreamWriter writer,
T value)
Writes the specified object to the specified writer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetTypeName, read, writepublic FunctionalScalarMarshaller(ScalarMarshaller<V> marshaller, Supplier<T> defaultFactory, org.wildfly.common.function.ExceptionFunction<T,V,IOException> function, org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
marshaller - the scalar marshaller used by this marshallerdefaultFactory - generates a default value returned by readFrom(ProtoStreamReader) if no field was written.function - a function that returns a value suitable for use by the specified scalar marshallerfactory - a function applied to the value read from the specified scalar marshallerpublic FunctionalScalarMarshaller(ScalarMarshaller<V> marshaller, Supplier<T> defaultFactory, BiPredicate<V,V> equals, org.wildfly.common.function.ExceptionFunction<T,V,IOException> function, org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
marshaller - the scalar marshaller used by this marshallerdefaultFactory - generates a default value returned by readFrom(ProtoStreamReader) if no field was written.equals - a predicate used to determine if writeTo(ProtoStreamWriter, Object) should skip writing the field.function - a function that returns a value suitable for use by the specified scalar marshallerfactory - a function applied to the value read from the specified scalar marshallerpublic FunctionalScalarMarshaller(ScalarMarshaller<V> marshaller, Supplier<T> defaultFactory, org.wildfly.common.function.ExceptionPredicate<T,IOException> skipWrite, org.wildfly.common.function.ExceptionFunction<T,V,IOException> function, org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
marshaller - the scalar marshaller used by this marshallerdefaultFactory - generates a default value returned by readFrom(ProtoStreamReader) if no field was written.skipWrite - a predicate used to determine if writeTo(ProtoStreamWriter, Object) should skip writing the field.function - a function that returns a value suitable for use by the specified scalar marshallerfactory - a function applied to the value read from the specified scalar marshallerpublic FunctionalScalarMarshaller(Class<? extends T> targetClass, ScalarMarshaller<V> marshaller, org.wildfly.common.function.ExceptionFunction<T,V,IOException> function, org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
targetClass - the type of this marshallermarshaller - the scalar marshaller used by this marshallerfunction - a function that returns a value suitable for use by the specified scalar marshallerfactory - a function applied to the value read from the specified scalar marshallerpublic FunctionalScalarMarshaller(Class<? extends T> targetClass, ScalarMarshaller<V> marshaller, Supplier<T> defaultFactory, org.wildfly.common.function.ExceptionFunction<T,V,IOException> function, org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
targetClass - the type of this marshallermarshaller - the scalar marshaller used by this marshallerdefaultFactory - generates a default value returned by readFrom(ProtoStreamReader) if no field was written.function - a function that returns a value suitable for use by the specified scalar marshallerfactory - a function applied to the value read from the specified scalar marshallerpublic FunctionalScalarMarshaller(Class<? extends T> targetClass, ScalarMarshaller<V> marshaller, Supplier<T> defaultFactory, BiPredicate<V,V> equals, org.wildfly.common.function.ExceptionFunction<T,V,IOException> function, org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
targetClass - the type of this marshallermarshaller - the scalar marshaller used by this marshallerdefaultFactory - generates a default value returned by readFrom(ProtoStreamReader) if no field was written.equals - a predicate comparing the default value with the value to write, used to determine if writeTo(ProtoStreamWriter, Object) should skip writing the field.function - a function that returns a value suitable for use by the specified scalar marshallerfactory - a function applied to the value read from the specified scalar marshallerpublic FunctionalScalarMarshaller(Class<? extends T> targetClass, ScalarMarshaller<V> marshaller, Supplier<T> defaultFactory, org.wildfly.common.function.ExceptionPredicate<T,IOException> skipWrite, org.wildfly.common.function.ExceptionFunction<T,V,IOException> function, org.wildfly.common.function.ExceptionFunction<V,T,IOException> factory)
targetClass - the type of this marshallermarshaller - the scalar marshaller used by this marshallerdefaultFactory - generates a default value returned by readFrom(ProtoStreamReader) if no field was written.skipWrite - a predicate used to determine if writeTo(ProtoStreamWriter, Object) should skip writing the field.function - a function that returns a value suitable for use by the specified scalar marshallerfactory - a function applied to the value read from the specified scalar marshallerpublic T readFrom(ProtoStreamReader reader) throws IOException
MarshallablereadFrom in interface Marshallable<T>reader - a ProtoStream readerIOException - if the object could not be readpublic void writeTo(ProtoStreamWriter writer, T value) throws IOException
MarshallablewriteTo in interface Marshallable<T>writer - a ProtoStream writervalue - the object to be writtenIOException - if the object could not be writtenpublic Class<? extends T> getJavaClass()
MarshallablegetJavaClass in interface org.infinispan.protostream.BaseMarshaller<T>getJavaClass in interface Marshallable<T>Copyright © 2023 JBoss by Red Hat. All rights reserved.