Class SerializationLimitPolicy
java.lang.Object
com.tangosol.io.SerializationLimitPolicy
Generic serializer-owned limits for serialized container structures.
- Since:
- 26.04
- Author:
- Aleks Seovic 2026.05.20
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longInitial hardened serialized container byte cap.static final intInitial hardened array/collection/object element cap.static final intInitial hardened map-entry cap.static final StringMaximum serialized container bytes property.static final StringMaximum array/collection/object element count property.static final StringMaximum map-entry count property.static final StringSerializer limits element.static final StringMaximum serialized container bytes element.static final StringMaximum array/collection/object element count element.static final StringMaximum map-entry count element. -
Constructor Summary
ConstructorsConstructorDescriptionSerializationLimitPolicy(Long cbMaxContainer, Integer cMaxElements, Integer cMaxMapEntries) Create a policy. -
Method Summary
Modifier and TypeMethodDescriptionstatic Serializerapply(Serializer serializer, SerializationLimitPolicy policy) Apply a policy to a serializer if it supports limit injection.static SerializationLimitPolicyfromXml(XmlElement xmlLimits) Parse a<limits>element as an override policy.static SerializationLimitPolicyReturn the global default policy.Return the maximum serialized container byte count, ornullfor unlimited.Return the maximum array, collection, or object-array element count, ornullfor unlimited.Return the maximum map-entry count, ornullfor unlimited.merge(SerializationLimitPolicy override) Merge this policy with the supplied override.voidvalidateContainerBytes(String sKind, int cb) Validate a byte count.voidvalidateElements(String sKind, int c) Validate an element count.voidvalidateMapEntries(String sKind, int c) Validate a map-entry count.
-
Field Details
-
PROP_MAX_CONTAINER_BYTES
Maximum serialized container bytes property.- See Also:
-
PROP_MAX_ELEMENTS
Maximum array/collection/object element count property.- See Also:
-
PROP_MAX_MAP_ENTRIES
-
XML_LIMITS
-
XML_MAX_CONTAINER_BYTES
Maximum serialized container bytes element.- See Also:
-
XML_MAX_ELEMENTS
Maximum array/collection/object element count element.- See Also:
-
XML_MAX_MAP_ENTRIES
-
DEFAULT_MAX_CONTAINER_BYTES
public static final long DEFAULT_MAX_CONTAINER_BYTESInitial hardened serialized container byte cap.- See Also:
-
DEFAULT_MAX_ELEMENTS
public static final int DEFAULT_MAX_ELEMENTSInitial hardened array/collection/object element cap.- See Also:
-
DEFAULT_MAX_MAP_ENTRIES
public static final int DEFAULT_MAX_MAP_ENTRIESInitial hardened map-entry cap.- See Also:
-
-
Constructor Details
-
SerializationLimitPolicy
-
-
Method Details
-
getMaxContainerBytes
Return the maximum serialized container byte count, ornullfor unlimited.- Returns:
- the maximum serialized container byte count
-
getMaxElements
Return the maximum array, collection, or object-array element count, ornullfor unlimited.- Returns:
- the maximum element count
-
getMaxMapEntries
Return the maximum map-entry count, ornullfor unlimited.- Returns:
- the maximum map-entry count
-
validateContainerBytes
Validate a byte count.- Parameters:
sKind- the structure kindcb- the byte count- Throws:
IOException- if the count is invalid or exceeds the policy
-
validateElements
Validate an element count.- Parameters:
sKind- the structure kindc- the element count- Throws:
IOException- if the count is invalid or exceeds the policy
-
validateMapEntries
Validate a map-entry count.- Parameters:
sKind- the structure kindc- the entry count- Throws:
IOException- if the count is invalid or exceeds the policy
-
merge
Merge this policy with the supplied override. Anynullvalues in the override inherit from this policy.- Parameters:
override- the override policy, ornull- Returns:
- the merged policy
-
getDefault
Return the global default policy.- Returns:
- the global default policy
-
fromXml
Parse a<limits>element as an override policy.- Parameters:
xmlLimits- the limits element, ornull- Returns:
- the parsed policy, or
null
-
apply
Apply a policy to a serializer if it supports limit injection.- Parameters:
serializer- the serializerpolicy- the policy, ornull- Returns:
- the serializer
-