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 StringconvertKeyValueSchemaInfoDataToString(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 StringgetStringSchemaVersion(byte[] schemaVersionBytes) static StringjsonifyKeyValueSchemaInfo(KeyValue<SchemaInfo, SchemaInfo> kvSchemaInfo) Jsonify the key/value schema info.static StringjsonifySchemaInfo(SchemaInfo schemaInfo) Jsonify the schema info.static StringjsonifySchemaInfoWithVersion(SchemaInfoWithVersion schemaInfoWithVersion) Jsonify the schema info with version.static StringserializeSchemaProperties(Map<String, String> properties) Serialize schema properties.static ObjecttoAvroObject(Object value) static com.google.gson.JsonElementtoJsonElement(String str) static voidvalidateFieldSchema(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) throws IOException 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
- Throws:
IOException
-
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
-