Class SchemaUtils
- java.lang.Object
-
- org.apache.pulsar.client.impl.schema.SchemaUtils
-
public final class SchemaUtils extends java.lang.ObjectUtils for schemas.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]convertKeyValueDataStringToSchemaInfoSchema(byte[] keyValueSchemaInfoDataJsonBytes)convert the key/value schema info data json bytes to key/value schema info data bytesstatic java.lang.StringconvertKeyValueSchemaInfoDataToString(org.apache.pulsar.common.schema.KeyValue<org.apache.pulsar.common.schema.SchemaInfo,org.apache.pulsar.common.schema.SchemaInfo> kvSchemaInfo)convert the key/value schema info data to stringstatic java.util.Map<java.lang.String,java.lang.String>deserializeSchemaProperties(java.lang.String serializedProperties)Deserialize schema properties from a serialized schema properties.static java.lang.StringgetStringSchemaVersion(byte[] schemaVersionBytes)static java.lang.StringjsonifyKeyValueSchemaInfo(org.apache.pulsar.common.schema.KeyValue<org.apache.pulsar.common.schema.SchemaInfo,org.apache.pulsar.common.schema.SchemaInfo> kvSchemaInfo)Jsonify the key/value schema info.static java.lang.StringjsonifySchemaInfo(org.apache.pulsar.common.schema.SchemaInfo schemaInfo)Jsonify the schema info.static java.lang.StringjsonifySchemaInfoWithVersion(org.apache.pulsar.common.schema.SchemaInfoWithVersion schemaInfoWithVersion)Jsonify the schema info with verison.static java.lang.StringserializeSchemaProperties(java.util.Map<java.lang.String,java.lang.String> properties)Serialize schema propertiesstatic java.lang.ObjecttoAvroObject(java.lang.Object value)static com.google.gson.JsonObjecttoJsonObject(java.lang.String json)static voidvalidateFieldSchema(java.lang.String name, org.apache.pulsar.common.schema.SchemaType type, java.lang.Object val)
-
-
-
Method Detail
-
validateFieldSchema
public static void validateFieldSchema(java.lang.String name, org.apache.pulsar.common.schema.SchemaType type, java.lang.Object val)
-
toAvroObject
public static java.lang.Object toAvroObject(java.lang.Object value)
-
getStringSchemaVersion
public static java.lang.String getStringSchemaVersion(byte[] schemaVersionBytes)
-
jsonifySchemaInfo
public static java.lang.String jsonifySchemaInfo(org.apache.pulsar.common.schema.SchemaInfo schemaInfo)
Jsonify the schema info.- Parameters:
schemaInfo- the schema info- Returns:
- the jsonified schema info
-
jsonifySchemaInfoWithVersion
public static java.lang.String jsonifySchemaInfoWithVersion(org.apache.pulsar.common.schema.SchemaInfoWithVersion schemaInfoWithVersion)
Jsonify the schema info with verison.- Parameters:
schemaInfoWithVersion- the schema info- Returns:
- the jsonified schema info with version
-
toJsonObject
public static com.google.gson.JsonObject toJsonObject(java.lang.String json)
-
jsonifyKeyValueSchemaInfo
public static java.lang.String jsonifyKeyValueSchemaInfo(org.apache.pulsar.common.schema.KeyValue<org.apache.pulsar.common.schema.SchemaInfo,org.apache.pulsar.common.schema.SchemaInfo> kvSchemaInfo)
Jsonify the key/value schema info.- Parameters:
kvSchemaInfo- the key/value schema info- Returns:
- the jsonified schema info
-
convertKeyValueSchemaInfoDataToString
public static java.lang.String convertKeyValueSchemaInfoDataToString(org.apache.pulsar.common.schema.KeyValue<org.apache.pulsar.common.schema.SchemaInfo,org.apache.pulsar.common.schema.SchemaInfo> kvSchemaInfo) throws java.io.IOExceptionconvert the key/value schema info data to string- Parameters:
kvSchemaInfo- the key/value schema info- Returns:
- the convert schema info data string
- Throws:
java.io.IOException
-
convertKeyValueDataStringToSchemaInfoSchema
public static byte[] convertKeyValueDataStringToSchemaInfoSchema(byte[] keyValueSchemaInfoDataJsonBytes) throws java.io.IOExceptionconvert 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:
java.io.IOException
-
serializeSchemaProperties
public static java.lang.String serializeSchemaProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Serialize schema properties- Parameters:
properties- schema properties- Returns:
- the serialized schema properties
-
deserializeSchemaProperties
public static java.util.Map<java.lang.String,java.lang.String> deserializeSchemaProperties(java.lang.String serializedProperties)
Deserialize schema properties from a serialized schema properties.- Parameters:
serializedProperties- serialized properties- Returns:
- the deserialized properties
-
-