use of org.infinispan.commons.marshall.SerializeFunctionWith in project infinispan by infinispan.
the class CommandsFactoryImpl method getValueMatcher.
private ValueMatcher getValueMatcher(Object o) {
SerializeFunctionWith ann = o.getClass().getAnnotation(SerializeFunctionWith.class);
if (ann != null)
return ValueMatcher.valueOf(ann.valueMatcher().toString());
Externalizer ext = ((GlobalMarshaller) marshaller).findExternalizerFor(o);
if (ext instanceof LambdaExternalizer)
return ValueMatcher.valueOf(((LambdaExternalizer) ext).valueMatcher(o).toString());
return ValueMatcher.MATCH_ALWAYS;
}
use of org.infinispan.commons.marshall.SerializeFunctionWith 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