use of org.kie.server.api.model.Wrapped in project droolsjbpm-integration by kiegroup.
the class MarshallerHelper method unmarshal.
public <T> T unmarshal(String data, String marshallingFormat, Class<T> unmarshalType) {
if (data == null || data.isEmpty()) {
return null;
}
MarshallingFormat format = getFormat(marshallingFormat);
Marshaller marshaller = serverMarshallers.get(format);
if (marshaller == null) {
marshaller = MarshallerFactory.getMarshaller(getExtraClasses(registry), format, this.getClass().getClassLoader());
serverMarshallers.put(format, marshaller);
}
Object instance = marshaller.unmarshall(data, unmarshalType, MarshallingFormat.buildParameters(marshallingFormat));
if (instance instanceof Wrapped) {
return (T) ((Wrapped) instance).unwrap();
}
return (T) instance;
}
Aggregations