use of org.infinispan.commons.marshall.SerializeWith in project infinispan by infinispan.
the class SerializeWithExtFactory method getExternalizer.
@Override
public Externalizer getExternalizer(Class<?> type) {
SerializeWith serialWithAnn = type.getAnnotation(SerializeWith.class);
SerializeFunctionWith lambdaSerialWithAnn = type.getAnnotation(SerializeFunctionWith.class);
if (serialWithAnn == null && lambdaSerialWithAnn == null) {
// Check for JBoss Marshaller's @Externalize
return jbmarExtFactory.getExternalizer(type);
} else {
try {
org.infinispan.commons.marshall.Externalizer ext = serialWithAnn != null ? serialWithAnn.value().newInstance() : lambdaSerialWithAnn.value().newInstance();
return new JBossExternalizerAdapter(ext);
} catch (Exception e) {
throw new IllegalArgumentException(String.format("Cannot instantiate externalizer for %s", type), e);
}
}
}
Aggregations