Class 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.
    Galder ZamarreƱo
    • Constructor Detail

      • MarshallableTypeHints

        public MarshallableTypeHints()
    • Method Detail

      • getBufferSizePredictor

        public BufferSizePredictor getBufferSizePredictor​(Class<?> type)
        Get the serialized form size predictor for a particular type.
        type - Marshallable type for which serialized form size will be predicted
        an instance of BufferSizePredictor
      • 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.
        type - Marshallable type to check whether an attempt to mark it as marshallable has been made.
        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.
        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.