This protected method allows a subclass to add to the mappers a class type that can be
serialized using its toString().

@param serializable The type of class that can be serialized using its toString() method.
764442
protected void addSerializableClass(Class<?> serializable) {
        safeMapper.addMixIn(serializable, UseToStringAsValueMixIn.class);
        fullMapper.addMixIn(serializable, UseToStringAsValueMixIn.class);
    }
1231323
public static void enableThriftSerialization(Configuration conf) {
		String ser = conf.get("io.serializations").trim();
		if (ser.length() !=0 ) {
			ser += ",";
		}
		//Adding the Thrift serialization
		ser += ThriftSerialization.class.getName();
		conf.set("io.serializations", ser);
  }
735886
public void convertToTypes( String serialization, Class<?> clazz, JsonObject newDef ) {
		convertToTypes( serialization, clazz.getSimpleName(), newDef );
		this.processedClasses.add( clazz );
	}
37772
public static void enableProtoStuffSerialization(Configuration conf) {
		String ser = conf.get("io.serializations").trim();
		if(ser.length() != 0) {
			ser += ",";
		}
		// Adding the ProtoStuff serialization
		ser += ProtoStuffSerialization.class.getName();
		conf.set("io.serializations", ser);
	}
1258547
protected void register(Serializer serializer, String... mediaTypes) {
        for (String mediaType : mediaTypes) {
            this.serializerMap.put(mediaType, serializer);
        }
    }
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);
	}
1047481
public Datatype.Builder setBuilderSerializable(boolean builderSerializable) {
    this.builderSerializable = builderSerializable;
    _unsetProperties.remove(Property.BUILDER_SERIALIZABLE);
    return (Datatype.Builder) this;
  }
996857
public final void addDeserializer(@NotNull final SerializedDataType type, final String contentType,
            @NotNull final Deserializer deserializer) {

        Contract.requireArgNotNull("type", type);
        Contract.requireArgNotNull("contentType", contentType);
        Contract.requireArgNotNull("deserializer", deserializer);

        final Key key = new Key(type, contentType);
        desMap.put(key, deserializer);

    }
845521
public void addSelections(Class<?> selectionType) {
		List<Field> fields = JpaHelper.listFields(selectionType);
		for (Field field : fields) {
			if (field.getName().equals("serialVersionUID"))
				continue;
			if (type != null && JpaHelper.findField(type, field.getName()) != null) {
				if (JpaHelper.findField(type, field.getName()).getType().equals(field.getType())) {
					this.selections.add(field.getName());
				}
			}
		}
	}
1127696
private void _serializeSerializable(Serializable serializable, StringBuilder sb) throws ConverterException {

	sb.append(goIn());
	sb.append("evaluateJava(").append(QUOTE_CHR);
	try {
	    sb.append(JavaConverter.serialize(serializable));
	}
	catch (IOException e) {
	    throw toConverterException(e);
	}
	sb.append(QUOTE_CHR).append(')');
    }
461473
public final void register(Class type, Serializer serializer) {
        if (type == null) {
            throw new IllegalArgumentException("Class type information is required!");
        }
        if (serializer.getTypeId() <= 0) {
            throw new IllegalArgumentException(
                    "Type ID must be positive! Current: " + serializer.getTypeId() + ", Serializer: " + serializer);
        }
        safeRegister(type, createSerializerAdapter(serializer, this));
    }
874452
private Serializer getSupportedSerializer(Object o) throws SerializerException {
        for (Serializer s : serializers) {
            if (s.canWrite(o)) {
                return s;
            }
        }
        throw new SerializerException("Unable to find serializer for object with type '" + o.getClass() + "'");
    }
197731
protected static String serialize(Serializable serializable) throws JMSException {
        if (serializable == null) {
            return null;
        }
        String serializedString;
        ObjectOutputStream objectOutputStream = null;
        try {
            ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
            objectOutputStream = new ObjectOutputStream(bytesOut);
            objectOutputStream.writeObject(serializable);
            objectOutputStream.flush();
            serializedString = Base64.encodeAsString(bytesOut.toByteArray());
        } catch (IOException e) {
            LOG.error("IOException: cannot serialize objectMessage", e);
            throw convertExceptionToMessageFormatException(e);
        } finally {
            if (objectOutputStream != null) {
                try {
                    objectOutputStream.close();
                } catch (IOException e) {
                    LOG.warn(e.getMessage());
                }
            }
        }
        return serializedString;
    }
300153
public synchronized void registerSerializer(Serializer serializer) {
    Class objClass = getSerializerType(serializer);
    if (!serializers.containsKey(objClass)) {
      int index = COUNTER.getAndIncrement();
      serializers.put(objClass, new SerializerWrapper(index, serializer));
      if (serializersArray.length <= index) {
        serializersArray = Arrays.copyOf(serializersArray, index + 1);
      }
      serializersArray[index] = serializer;

      LOGGER.info(String
          .format("Registered new serializer '%s' %n  for '%s' at index %d", serializer.getClass().getName(),
              objClass.getName(), index));
    }
  }
186194
private void addClassInfo(Object value, Class<?> declaredClass) {
        if (value instanceof Bean && !(value instanceof ImmutableBean)) {
            throw new IllegalArgumentException(
                    "Can only serialize immutable beans in referencing binary format: " + value.getClass().getName());
        }

        if (value instanceof ImmutableBean) {
            boolean isConvertible = settings.getConverter().isConvertible(value.getClass());
            boolean noNeedToSerializeTypeName = declaredClass.equals(value.getClass()) &&
                    (classes.containsKey(value.getClass()) || isConvertible);

            if (noNeedToSerializeTypeName) {
                return;
            }

            ImmutableBean bean = (ImmutableBean) value;
            // Don't need metaproperty info if it's a convertible type
            ClassInfo classInfo = isConvertible ?
                    new ClassInfo(value.getClass(), new MetaProperty<?>[0]) :
                    classInfoFromMetaBean(bean.metaBean(), bean.getClass());

            addClassInfoAndIncrementCount(bean.getClass(), classInfo);
            
        } else if (value instanceof Class<?>) {
            Class<?> type = (Class<?>) value;
            if (type.equals(declaredClass) || settings.getConverter().isConvertible(type)) {
                return;
            }
            if (Bean.class.isAssignableFrom(type) && !ImmutableBean.class.isAssignableFrom(type)) {
                throw new IllegalArgumentException(
                        "Can only serialize immutable beans in referencing binary format: " + type.getName());
            }
            if (ImmutableBean.class.isAssignableFrom(type)) {
                if (classes.containsKey(type)) {
                    classSerializationCount.compute(type, BeanReferences::incrementOrOne);
                    return;
                }
                ClassInfo classInfo;
                if (settings.getConverter().isConvertible(type)) {
                    // Don't need metaproperty info if it's a convertible type
                    classInfo = new ClassInfo(type, new MetaProperty<?>[0]);
                } else {
                    SerDeserializer deser = settings.getDeserializers().findDeserializer(type);
                    MetaBean metaBean = deser.findMetaBean(type);
                    classInfo = classInfoFromMetaBean(metaBean, type);
                }
                addClassInfoAndIncrementCount(type, classInfo);
            }
            
        } else if (declaredClass == Object.class && !value.getClass().equals(String.class)) {
            Class<?> effectiveType = settings.getConverter().findTypedConverter(value.getClass()).getEffectiveType();
            ClassInfo classInfo = new ClassInfo(value.getClass(), new MetaProperty<?>[0]);
            addClassInfoAndIncrementCount(effectiveType, classInfo);
            
        } else if (!settings.getConverter().isConvertible(declaredClass)) {
            ClassInfo classInfo = new ClassInfo(value.getClass(), new MetaProperty<?>[0]);
            addClassInfoAndIncrementCount(value.getClass(), classInfo);
        }
    }
21931
private void _initializeObjectMapper() {

		SimpleModule module = new SimpleModule();
		module.addSerializer(Alert.class, new Alert.Serializer());
		module.addSerializer(Trigger.class, new Trigger.Serializer());
		module.addSerializer(Notification.class, new Notification.Serializer());
		module.addSerializer(PrincipalUser.class, new Alert.PrincipalUserSerializer());
		module.addDeserializer(Alert.class, new Alert.Deserializer());

		_mapper.registerModule(module);
	}
1293262
private Class<?> serializerToClass(String value) {
    try {
      return Thread.currentThread().getContextClassLoader().loadClass(value);
    } catch (ClassNotFoundException e) {
      throw new ConfigurationException("unknown serializable type: " + value);
    }
  }