Returns the appropriate Serializer (if one exists) else null.

@param klass
@return
192526
private Serializer<?> getSerializerFromClass(Class<?> klass) {
        if(klass == Integer.class) {
            return Serializer.INTEGER;
        }
        else if(klass == Long.class) {
            return Serializer.LONG;
        }
        else if(klass == Boolean.class) {
            return Serializer.BOOLEAN;
        }
        else if(klass == String.class) {
            return Serializer.STRING;
        }
        return null; //Default POJO serializer
    }
737859
public static <T> T loadAnyServiceProvider( Class<T> klass )
    {
        T provider = findAnyServiceProvider( klass );
        if (provider == null) {
            throw new NoServiceProviderException( klass.getName()
                + ": no service provider found in META-INF/services on classpath" );            
        }
        return provider;
    }
1111601
public static JAXBSerialiser getInstance(Class<?>... classes)
	{
		if (log.isTraceEnabled())
			log.trace("Create serialiser for " + Arrays.asList(classes));

		return new JAXBSerialiser(classes);
	}
1212882
public CacheConfigurationBuilder<K, V> withKeySerializer(Serializer<K> keySerializer) {
    return withSerializer(new DefaultSerializerConfiguration<>(requireNonNull(keySerializer, "Null key serializer"), DefaultSerializerConfiguration.Type.KEY));
  }
320375
public Serializer getObjectSerializer(Class<?> cl)
        throws HessianProtocolException {
        Serializer serializer = getSerializer(cl);

        if (serializer instanceof ObjectSerializer)
            return ((ObjectSerializer) serializer).getObjectSerializer();
        else
            return serializer;
    }
488218
private static SerializerFactory getInstance() {
    if (instance == null) {
      String className = JacksonSerializerFactory.class.getName();
      try {
        className = System.getProperty(SERIALIZER_FACTORY_CLASS_NAME);
      } catch (Exception e) {
      }

      if (className != null) {
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        try {
          Class<?> clazz = loader.loadClass(className);
          instance = (SerializerFactory) clazz.newInstance();
        } catch (Exception e) {
          throw new IllegalArgumentException("Error instantiating serializer factory.");
        }
      } else {
        instance = new JacksonSerializerFactory();
      }
    }
    return instance;
  }
600144
public static Class<?> getClass(ObjectIdentifier oid)
            throws CertificateException {
        OIDInfo info = oidMap.get(oid);
        return (info == null) ? null : info.getClazz();
    }
1264320
public CacheConfigurationBuilder<K, V> withKeySerializer(Class<? extends Serializer<K>> keySerializerClass) {
    return withSerializer(new DefaultSerializerConfiguration<>(requireNonNull(keySerializerClass, "Null key serializer class"), DefaultSerializerConfiguration.Type.KEY));
  }
603632
public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) {
		if (type == null || serializerClass == null) {
			throw new NullPointerException("Cannot register null class or serializer.");
		}
		defaultKryoSerializerClasses.put(type, serializerClass);
	}
873924
@Override
    public ISerializer<?> get(Class<?> clazz) {
        ISerializer<?> contextSerializer = super.get(clazz);

        if (contextSerializer != null) {
            return contextSerializer;
        }

        for (ISerializer<?> item : this) {
            if (item.getType().isAssignableFrom(clazz)) {
                return item;
            }
        }

        return null;
    }
1085003
@SuppressWarnings("unchecked")
    public <T> Serializer<T> getSerializer(Class<T> type, String mediaType) throws SerializationException {
        checkNotNull(type, "Type (Class<T>) cannot be null.");
        checkNotNull(mediaType, "Media-Type cannot be null.");

        final String typeName = getClassName(type);
        final Key key = new Key(typeName, mediaType);

        logger.log(Level.FINE, "Querying for Serializer of type '" + typeName + "' and " + "media-type '" + mediaType
                + "'.");

        ArrayList<SerializerHolder> holders = serializers.get(typeName);
        if (holders != null) {
            for (SerializerHolder holder : holders) {
                if (holder.key.matches(key)) {
                    logger.log(Level.FINE, "Serializer for type '" + holder.serializer.handledType() + "' and " +
                            "media-type '" + Arrays.toString(holder.serializer.mediaType()) + "' matched: " +
                            holder.serializer.getClass().getName());
                    return (Serializer<T>) holder.serializer;
                }
            }
        }

        logger.log(Level.WARNING, "There is no Serializer registered for type " + type.getName() +
                " and media-type " + mediaType + ". If you're relying on auto-generated serializers," +
                " please make sure you imported the correct GWT Module.");

        return null;
    }
298279
@SuppressWarnings("unchecked")
	@Override
	public <E> String serialize(E object) {
		if (object == null)
			return null;

		SegmentedStringWriter source = new SegmentedStringWriter(buffer.get());
		try (SerializerWrapper serializer = createSerializer(source)) {
			mapperFor((Class<E>) object.getClass()).serialize(this, serializer, object);
		} catch (Exception e) {
			e.printStackTrace();
			throw new KriptonRuntimeException(e);
		}

		return source.getAndClear();

	}
1326611
public <T> Unmarshaller<T, JsonUnmarshallerContext> getUnmarshaller(Class<T> type, UnmarshallerType unmarshallerType) {
        return null;
    }
413656
@VisibleForTesting
  public static <T> Iterable<T> getCandidatesViaHardCoded(
      Class<T> klass, Iterable<Class<?>> hardcoded) {
    return ServiceProviders.getCandidatesViaHardCoded(klass, hardcoded);
  }
879367
private Field findFieldInClass(Class klass, String fieldName) throws NoSuchFieldException {
        try {
            return klass.getDeclaredField(fieldName);
        } catch (NoSuchFieldException e) {
            Class superclass = klass.getSuperclass();
            if (superclass != null) {
                return findFieldInClass(superclass, fieldName);
            }
            throw new NoSuchFieldException();
        }
    }
754637
protected final SerializerFactory findSerializerFactory()
    {
        SerializerFactory factory = _serializerFactory;

        if (factory == null) {
            factory = SerializerFactory.createDefault();
            _defaultSerializerFactory = factory;
            _serializerFactory = factory;
        }

        return factory;
    }
778077
public AnnSchema getSchema(final Class<? extends Ann> klass) {
    for (AnnSchema ann : annSchemas)
      if (ann.getKlass().equals(klass))
        return ann;
    return null;
  }