Class MarshallableTypeHints

java.lang.Object
org.infinispan.commons.marshall.MarshallableTypeHints

public final class MarshallableTypeHints extends Object
Class providing hints about marshallable types, such as whether a particular type is marshallable or not, or an accurate approach to the serialized size of a particular type.
Since:
5.1
Author:
Galder ZamarreƱo
  • Constructor Details

    • MarshallableTypeHints

      public MarshallableTypeHints()
  • Method Details

    • getBufferSizePredictor

      public BufferSizePredictor getBufferSizePredictor(Class<?> type)
      Get the serialized form size predictor for a particular type.
      Parameters:
      type - Marshallable type for which serialized form size will be predicted
      Returns:
      an instance of BufferSizePredictor
    • getBufferSizePredictor

      public BufferSizePredictor getBufferSizePredictor(Object obj)
    • isKnownMarshallable

      public boolean isKnownMarshallable(Class<?> type)
      Returns whether the hint on whether a particular type is marshallable or not is available. This method can be used to avoid attempting to marshall a type, if the hints for the type have already been calculated.
      Parameters:
      type - Marshallable type to check whether an attempt to mark it as marshallable has been made.
      Returns:
      true if the type has been marked as marshallable at all, false if no attempt has been made to mark the type as marshallable.
    • isMarshallable

      public boolean isMarshallable(Class<?> type)
      Returns whether a type can be serialized. In order for a type to be considered marshallable, the type must have been marked as marshallable using the markMarshallable(Class, boolean) method earlier, passing true as parameter. If a type has not yet been marked as marshallable, this method will return false.
    • markMarshallable

      public void markMarshallable(Class<?> type, boolean isMarshallable)
      Marks a particular type as being marshallable or not being not marshallable.
      Parameters:
      type - Class to mark as serializable or non-serializable
      isMarshallable - Whether the type can be marshalled or not.
    • clear

      public void clear()
      Clear the cached marshallable type hints.