Package org.infinispan.query.remote

Source Code of org.infinispan.query.remote.CompatibilityReflectionMatcher

package org.infinispan.query.remote;

import org.hibernate.hql.ast.spi.EntityNamesResolver;
import org.infinispan.objectfilter.impl.ReflectionMatcher;
import org.infinispan.protostream.MessageMarshaller;
import org.infinispan.protostream.SerializationContext;

/**
* A sub-class of ReflectionMatcher that is able to lookup classes by their protobuf type name and can work when
* compatibility mode is used.
*
* @author anistor@redhat.com
* @since 7.0
*/
public final class CompatibilityReflectionMatcher extends ReflectionMatcher {

   public CompatibilityReflectionMatcher(final SerializationContext serializationContext) {
      super(new EntityNamesResolver() {
         @Override
         public Class<?> getClassFromName(String entityName) {
            try {
               MessageMarshaller messageMarshaller = (MessageMarshaller) serializationContext.getMarshaller(entityName);
               return messageMarshaller.getJavaClass();
            } catch (Exception e) {
               return null;
            }
         }
      });
   }
}
TOP

Related Classes of org.infinispan.query.remote.CompatibilityReflectionMatcher

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.