Obtain a serializer for the given key type.

@param type the type; may not be null
@param pack true if the serializer can/should pack keys together when possible, or false otherwise
@return the serializer
180696
public BTreeKeySerializer<?> bTreeKeySerializerFor( TypeFactory<?> type,
                                                        boolean pack ) {
        return serializers.bTreeKeySerializerFor(type.getType(), type.getComparator(), pack);
    }
259275
public Optional<MapperInstance> getKeySerializer( JType type ) {
        return Optional.fromNullable( keySerializers.get( type.getQualifiedSourceName() ) );
    }
961009
public void addDefaultSerializer (Class type, Serializer serializer) {
		if (type == null) throw new IllegalArgumentException("type cannot be null.");
		if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
		insertDefaultSerializer(type, new SingletonSerializerFactory(serializer));
	}
146524
public TypeSerializer<T> getReconfiguredSerializer() {
		Preconditions.checkState(
			isCompatibleWithReconfiguredSerializer(),
			"It is only possible to get a reconfigured serializer if the compatibility type is %s, but the type is %s",
			Type.COMPATIBLE_WITH_RECONFIGURED_SERIALIZER, resultType);
		return reconfiguredNewSerializer;
	}
160419
public Deserializer getListDeserializer(String type)
        throws HessianProtocolException {
        Deserializer deserializer = getDeserializer(type);

        if (deserializer != null)
            return deserializer;
        else if (_arrayListDeserializer != null)
            return _arrayListDeserializer;
        else {
            _arrayListDeserializer = new CollectionDeserializer(ArrayList.class);

            return _arrayListDeserializer;
        }
    }
100567
@Deprecated
	public VPackSlice serialize(final Object entity, final Type type) throws VPackParserException {
		return serialize(entity, new SerializeOptions().type(type));
	}
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);
	}
674479
protected final JDeserializerType getKeyDeserializerFromType( JType type ) throws UnsupportedTypeException, UnableToCompleteException {
        return getKeyDeserializerFromType( type, false, false );
    }
440004
public static IEntitySerializer getSerializer(final String serializeFormat) throws SerializationException {
		IEntitySerializer serializer = null;
		if (isValidSerializeFormat(serializeFormat)) {
			if (serializeFormat.equalsIgnoreCase(XML_SERIALIZE_FORMAT)) {
				serializer = new XMLSerializer();
			} else if (serializeFormat.equalsIgnoreCase(JSON_SERIALIZE_FORMAT)) {
				serializer = new JSONSerializer();
			}
		}
		return serializer;
	}
1245915
public <T> BinarySerializer<T> build(Class<T> type) {
		SerializerForType[] serializerForTypes = new SerializerForType[0];
		return build(type, serializerForTypes);
	}
43258
public static Serializer getSerializer(@SuppressWarnings("unused") java.lang.String mechType,
      java.lang.Class<? extends Operation> javaType, javax.xml.namespace.QName xmlType) {
    return new org.apache.axis.encoding.ser.BeanSerializer(javaType, xmlType, TYPE_DESC);
  }
249633
public static byte getSerializeTypeByName(String serialization) throws SofaRpcException {
        String sz = serialization.toLowerCase();
        Byte code;
        if (RpcConstants.SERIALIZE_HESSIAN2.equals(sz) || RpcConstants.SERIALIZE_HESSIAN.equals(sz)) {
            code = SerializerFactory.getCodeByAlias(RpcConstants.SERIALIZE_HESSIAN2);
        } else {
            code = SerializerFactory.getCodeByAlias(serialization);
        }
        if (code != null) {
            return code;
        } else {
            throw new SofaRpcException(RpcErrorType.SERVER_DESERIALIZE, "Unsupported serialize type " + serialization
                + " in http protocol.");
        }
    }
751090
private <T extends Serializable> Serializer getSerializer(QName xmlType, Class<T> clazz)
      throws SecurityException,
      NoSuchMethodException,
      IllegalArgumentException,
      IllegalAccessException,
      InvocationTargetException {
    Method getSerializer = clazz.getMethod("getSerializer", String.class, Class.class, QName.class);
    return (Serializer) getSerializer.invoke(null, null, clazz, xmlType);
  }
263266
private boolean isSerializableType(Class<?> type) {
    Boolean serializable = cache.get(type);
    if (serializable != null) {
      return serializable;
    }

    if (type == Object.class) {
      return true;
    }

    if (primitiveTypes.contains(type)) {
      cache.put(type, true);
      return true;
    }

    if (JsonSerializable.class.isAssignableFrom(type)) {
      cache.put(type, true);
      return true;
    }

    for (Class<?> clazz : serializableTypes) {
      if (clazz.isAssignableFrom(type)) {
        cache.put(type, true);
        return true;
      }
    }
    cache.put(type, false);
    return false;
  }
869038
protected final SerializedData serialize(final SerializedDataType type, final Object data) {
        return EscSpiUtils.serialize(serRegistry, type, data);
    }
1058005
public Serializer getSerializer(Class cls) {
    SerializerWrapper w = getSerializerWrapper(cls);
    if (w != null) {
      return w.serializer;
    }
    return null;
  }
117195
private static Class<?> findSerializableType(Class<?> type) {
    while (type != null && type != Object.class) {
      for (Class<?> iface : type.getInterfaces()) {
        if (iface == JsonSerializable.class) {
          return type;
        }
        Class<?> serializable = findSerializableType(iface);
        if (serializable != null) {
          return serializable;
        }
      }
      type = type.getSuperclass();
    }
    return null;
  }