Class MarshallableTypeHints


  • public final class MarshallableTypeHints
    extends java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clear the cached marshallable type hints.
      BufferSizePredictor getBufferSizePredictor​(java.lang.Class<?> type)
      Get the serialized form size predictor for a particular type.
      BufferSizePredictor getBufferSizePredictor​(java.lang.Object obj)  
      boolean isKnownMarshallable​(java.lang.Class<?> type)
      Returns whether the hint on whether a particular type is marshallable or not is available.
      boolean isMarshallable​(java.lang.Class<?> type)
      Returns whether a type can be serialized.
      void markMarshallable​(java.lang.Class<?> type, boolean isMarshallable)
      Marks a particular type as being marshallable or not being not marshallable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MarshallableTypeHints

        public MarshallableTypeHints()
    • Method Detail

      • getBufferSizePredictor

        public BufferSizePredictor getBufferSizePredictor​(java.lang.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​(java.lang.Object obj)
      • isKnownMarshallable

        public boolean isKnownMarshallable​(java.lang.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​(java.lang.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​(java.lang.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.