Class SchemaUtils
java.lang.Object
org.apache.pulsar.client.impl.schema.SchemaUtils
Utils for schemas.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
convertKeyValueDataStringToSchemaInfoSchema
(byte[] keyValueSchemaInfoDataJsonBytes) Convert the key/value schema info data json bytes to key/value schema info data bytes.static String
convertKeyValueSchemaInfoDataToString
(KeyValue<SchemaInfo, SchemaInfo> kvSchemaInfo) Convert the key/value schema info data to string.deserializeSchemaProperties
(String serializedProperties) Deserialize schema properties from a serialized schema properties.static String
getStringSchemaVersion
(byte[] schemaVersionBytes) static String
jsonifyKeyValueSchemaInfo
(KeyValue<SchemaInfo, SchemaInfo> kvSchemaInfo) Jsonify the key/value schema info.static String
jsonifySchemaInfo
(SchemaInfo schemaInfo) Jsonify the schema info.static String
jsonifySchemaInfoWithVersion
(SchemaInfoWithVersion schemaInfoWithVersion) Jsonify the schema info with version.static String
serializeSchemaProperties
(Map<String, String> properties) Serialize schema properties.static Object
toAvroObject
(Object value) static com.google.gson.JsonElement
toJsonElement
(String str) static void
validateFieldSchema
(String name, SchemaType type, Object val)
-
Method Details
-
validateFieldSchema
-
toAvroObject
-
getStringSchemaVersion
-
jsonifySchemaInfo
Jsonify the schema info.- Parameters:
schemaInfo
- the schema info- Returns:
- the jsonified schema info
-
jsonifySchemaInfoWithVersion
Jsonify the schema info with version.- Parameters:
schemaInfoWithVersion
- the schema info- Returns:
- the jsonified schema info with version
-
toJsonElement
-
jsonifyKeyValueSchemaInfo
Jsonify the key/value schema info.- Parameters:
kvSchemaInfo
- the key/value schema info- Returns:
- the jsonified schema info
-
convertKeyValueSchemaInfoDataToString
public static String convertKeyValueSchemaInfoDataToString(KeyValue<SchemaInfo, SchemaInfo> kvSchemaInfo) throws IOExceptionConvert the key/value schema info data to string.- Parameters:
kvSchemaInfo
- the key/value schema info- Returns:
- the convert schema info data string
- Throws:
IOException
-
convertKeyValueDataStringToSchemaInfoSchema
public static byte[] convertKeyValueDataStringToSchemaInfoSchema(byte[] keyValueSchemaInfoDataJsonBytes) Convert the key/value schema info data json bytes to key/value schema info data bytes.- Parameters:
keyValueSchemaInfoDataJsonBytes
- the key/value schema info data json bytes- Returns:
- the key/value schema info data bytes
-
serializeSchemaProperties
Serialize schema properties.- Parameters:
properties
- schema properties- Returns:
- the serialized schema properties
-
deserializeSchemaProperties
Deserialize schema properties from a serialized schema properties.- Parameters:
serializedProperties
- serialized properties- Returns:
- the deserialized properties
-