Interface ScalarMarshaller<T>

Type Parameters:
T - the type of this marshaller
All Superinterfaces:
Marshallable<T>, Readable<T>, Writable<T>
All Known Implementing Classes:
PackedArrayMarshaller, Scalar, ScalarClass

public interface ScalarMarshaller<T> extends Marshallable<T>
Marshaller for a single scalar value. This marshaller does not write any tags, nor does it read beyond a single value.
Author:
Paul Ferraro
  • Method Details

    • getWireType

      org.infinispan.protostream.descriptors.WireType getWireType()
      Returns the wire type of the scalar value written by this marshaller.
      Returns:
      the wire type of the scalar value written by this marshaller.
    • toMarshaller

      default <V> ProtoStreamMarshaller<V> toMarshaller(Class<V> targetClass, Function<V,T> unwrapper, Function<T,V> wrapper)
      Returns a marshaller for a wrapper of this scalar value, using the specified wrapping and unwrapping functions.
      Type Parameters:
      V - the wrapper type
      Parameters:
      targetClass - the wrapper marshaller type
      unwrapper - a function exposing the scalar type written by this marshaller from the wrapper instance
      wrapper - a function creating a wrapped instance from the scalar value read by this marshaller
      Returns:
      a new marshaller
    • toMarshaller

      default <V> ProtoStreamMarshaller<V> toMarshaller(Class<V> targetClass, Function<V,T> unwrapper, Supplier<V> defaultFactory, Function<T,V> wrapper)
      Returns a marshaller for a wrapper of this scalar value, using the specified wrapping and unwrapping functions.
      Type Parameters:
      V - the wrapper type
      Parameters:
      targetClass - the wrapper marshaller type
      unwrapper - a function exposing the scalar type written by this marshaller from the wrapper instance
      defaultFactory - provides the default value returned by the marshaller created by this function in the event that this marshaller did not write a scalar value.
      wrapper - a function creating a wrapped instance from the scalar value read by this marshaller
      Returns:
      a new marshaller
    • toMarshaller

      default <V> ProtoStreamMarshaller<V> toMarshaller(Class<V> targetClass, BiPredicate<T,T> equals, Function<V,T> unwrapper, Supplier<V> defaultFactory, Function<T,V> wrapper)
      Returns a marshaller for a wrapper of this scalar value, using the specified wrapping and unwrapping functions.
      Type Parameters:
      V - the wrapper type
      Parameters:
      targetClass - the wrapper marshaller type
      equals - a predicate indicating whether the wrapped scalar value of the object to be written by this marshaller matches the wrapped scalar value of the value returned by the specified default factory
      unwrapper - a function exposing the scalar type written by this marshaller from the wrapper instance
      defaultFactory - provides the default value returned by the marshaller created by this function in the event that this marshaller did not write a scalar value.
      wrapper - a function creating a wrapped instance from the scalar value read by this marshaller
      Returns:
      a new marshaller
    • toMarshaller

      default ProtoStreamMarshaller<Optional<T>> toMarshaller()
      Returns a marshaller for an Optional wrapper of this scalar value.
      Returns:
      an optional marshaller
    • toMarshaller

      default <V> ProtoStreamMarshaller<Optional<V>> toMarshaller(Function<V,T> unwrapper, Function<T,V> wrapper)
      Returns a marshaller for an Optional wrapper of this scalar value.
      Type Parameters:
      V - the scalar value type
      Parameters:
      unwrapper - a function exposing the scalar type written by this marshaller from the wrapper instance
      wrapper - a function creating a wrapped instance from the scalar value read by this marshaller
      Returns:
      an optional marshaller
    • toMarshaller

      default <V> ProtoStreamMarshaller<V> toMarshaller(Class<V> targetClass, Predicate<V> skipWrite, Function<V,T> unwrapper, Supplier<V> defaultFactory, Function<T,V> wrapper)
      Returns a marshaller for a wrapper of this scalar value, using the specified wrapping and unwrapping functions.
      Type Parameters:
      V - the wrapper type
      Parameters:
      targetClass - the wrapper marshaller type
      skipWrite - a predicate indicating whether the marshaller returned by this function can skip writing its scalar value, and instead return the value returned by the default factory on read.
      unwrapper - a function exposing the scalar type written by this marshaller from the wrapper instance
      defaultFactory - provides the default value returned by the marshaller created by this function in the event that this marshaller did not write a scalar value.
      wrapper - a function creating a wrapped instance from the scalar value read by this marshaller
      Returns:
      a new marshaller