public synchronized RootSerializer createRootSerializer(String shortMessageName, Type type) { Message message = proto.getMessage(shortMessageName); if (message == null) { throw new IllegalStateException("can not find proto message to create serializer, name=" + shortMessageName); } return createRootSerializer(message, type); }
public synchronized <T> RootDeserializer<T> createRootDeserializer(String shortMessageName, Type type) { Message message = proto.getMessage(shortMessageName); if (message == null) { throw new IllegalStateException("can not find proto message to create deserializer, name=" + shortMessageName); } return createRootDeserializer(message, type); }
public synchronized <T> RootDeserializer<T> createPropertyRootDeserializer(String shortMessageName, Type propertyType) { Message message = proto.getMessage(shortMessageName); if (!ProtoUtils.isWrapProperty(message)) { return createRootDeserializer(shortMessageName, propertyType); } JavaType propertyWrapJavaType = TypeFactory.defaultInstance().constructParametricType( PropertyWrapper.class, TypeFactory.defaultInstance().constructType(propertyType)); RootDeserializer<PropertyWrapper<T>> deserializer = deserializerSchemaManager .createRootDeserializer(message, propertyWrapJavaType); return new RootPropertyWrapperDeserializer<>(deserializer); } }
private SchemaWriter<Object> createEntryWriter(String actualTypeName, Object _value) { Message message = protoMapper.getProto().getMessage(actualTypeName); if (message == null) { // not standard, protobuf can not support or not define this type , just extend return this::jsonExtend; } // standard pack RootSerializer valueSerializer = protoMapper.createRootSerializer(message, _value.getClass()); String valueCanonicalName = message.getCanonicalName(); return (output, value) -> { standardPack(output, value, valueCanonicalName, valueSerializer); }; }
public RootDeserializer createRootDeserializer(JavaType javaType, String shortMessageName) { Message message = proto.getMessage(shortMessageName); if (message == null) { throw new IllegalStateException("can not find proto message to create deserializer, name=" + shortMessageName); } return createRootDeserializer(javaType, message); }