Package org.infinispan.commons.marshall
Class MarshallableTypeHints
java.lang.Object
org.infinispan.commons.marshall.MarshallableTypeHints
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the cached marshallable type hints.getBufferSizePredictor
(Class<?> type) Get the serialized form size predictor for a particular type.boolean
isKnownMarshallable
(Class<?> type) Returns whether the hint on whether a particular type is marshallable or not is available.boolean
isMarshallable
(Class<?> type) Returns whether a type can be serialized.void
markMarshallable
(Class<?> type, boolean isMarshallable) Marks a particular type as being marshallable or not being not marshallable.
-
Constructor Details
-
MarshallableTypeHints
public MarshallableTypeHints()
-
-
Method Details
-
getBufferSizePredictor
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
-
isKnownMarshallable
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
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 themarkMarshallable(Class, boolean)
method earlier, passing true as parameter. If a type has not yet been marked as marshallable, this method will return false. -
markMarshallable
Marks a particular type as being marshallable or not being not marshallable.- Parameters:
type
- Class to mark as serializable or non-serializableisMarshallable
- Whether the type can be marshalled or not.
-
clear
public void clear()Clear the cached marshallable type hints.
-