Package org.rumbledb.serialization
Class SerializerUtils
java.lang.Object
org.rumbledb.serialization.SerializerUtils
Shared helpers for
Serializer implementations (map serialization, DM node names).-
Field Summary
FieldsModifier and TypeFieldDescription -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendDmNodeNameLexical(StringBuilder sb, Item item) static voidappendJsonEscapedString(StringBuilder sb, String value, CharsetEncoder encoder) Appends the JSON-escaped form ofvaluetosb, using the provided cached encoder to decide whether non-ASCII code points can be represented directly or must be Unicode-escaped.static voidappendJsonEscapedString(StringBuilder sb, String value, SerializationParameters params) Convenience overload that builds a throwaway encoder fromparams.static voidappendXmlDeclaration(StringBuilder sb, SerializationParameters params) static StringescapeUriAttribute(String value) Escapes URI attribute values using percent-encoding for non-ASCII characters.static Stringstatic voidserializeMapAsJsonSafeObject(Serializer serializer, SerializationParameters params, Item mapItem, StringBuilder sb, String indent, String optionalPrefixBeforeOpenBrace) Serializes a map item as a JSON object shape (with optional TYSON type prefix before "{").
-
Field Details
-
URI_ATTRIBUTES
-
HTML5_VOID_ELEMENTS
-
-
Method Details
-
escapeUriAttribute
Escapes URI attribute values using percent-encoding for non-ASCII characters. -
appendDmNodeNameLexical
-
appendXmlDeclaration
-
getEffectiveXmlVersion
-
serializeMapAsJsonSafeObject
public static void serializeMapAsJsonSafeObject(Serializer serializer, SerializationParameters params, Item mapItem, StringBuilder sb, String indent, String optionalPrefixBeforeOpenBrace) Serializes a map item as a JSON object shape (with optional TYSON type prefix before "{").- Parameters:
optionalPrefixBeforeOpenBrace- e.g. TYSON("type"); null or empty for JSON / hybrid
-
appendJsonEscapedString
Appends the JSON-escaped form ofvaluetosb, using the provided cached encoder to decide whether non-ASCII code points can be represented directly or must be Unicode-escaped. -
appendJsonEscapedString
public static void appendJsonEscapedString(StringBuilder sb, String value, SerializationParameters params) Convenience overload that builds a throwaway encoder fromparams. PreferappendJsonEscapedString(StringBuilder, String, CharsetEncoder)when a cached encoder is available (e.g. frombuildEncodingChecker(org.rumbledb.serialization.SerializationParameters)).
-