Search in sources :

Example 1 with SerializeWith

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);
        }
    }
}
Also used : SerializeFunctionWith(org.infinispan.commons.marshall.SerializeFunctionWith) SerializeWith(org.infinispan.commons.marshall.SerializeWith)

Aggregations

SerializeFunctionWith (org.infinispan.commons.marshall.SerializeFunctionWith)1 SerializeWith (org.infinispan.commons.marshall.SerializeWith)1