Source:
public <T> DefaultSerializationProviderConfiguration addSerializerFor(Class<T> serializableClass, Class<? extends Serializer<T>> serializerClass, boolean overwrite) { if (serializableClass == null) { throw new NullPointerException("Serializable class cannot be null"); } if (serializerClass == null) { throw new NullPointerException("Serializer class cannot be null"); } boolean transientConstructorPresent; boolean persistentConstructorPresent; if(transientConstructorPresent = isConstructorPresent(serializerClass, ClassLoader.class)) { if (!overwrite && transientSerializers.containsKey(serializableClass)) { throw new IllegalArgumentException("Duplicate transient serializer for class : " + serializableClass.getName()); } else { transientSerializers.put(serializableClass, serializerClass); } } if(persistentConstructorPresent = isConstructorPresent(serializerClass, ClassLoader.class, StateRepository.class)) { if (!overwrite && persistentSerializers.containsKey(serializableClass)) { throw new IllegalArgumentException("Duplicate persistent serializer for class : " + serializableClass.getName()); } else { persistentSerializers.put(serializableClass, serializerClass); } } if(persistentConstructorPresent = isConstructorPresent(serializerClass, ClassLoader.class, FileBasedPersistenceContext.class)) { if (!overwrite && persistentSerializers.containsKey(serializableClass)) { throw new IllegalArgumentException("Duplicate persistent serializer for class : " + serializableClass.getName()); } else { persistentSerializers.put(serializableClass, serializerClass); } } if(!transientConstructorPresent && !persistentConstructorPresent) { throw new IllegalArgumentException("The serializer: " + serializerClass.getName() + " does not meet the constructor requirements for either transient or persistent caches."); } return this; }

Target:
public <T> DefaultSerializationProviderConfiguration addSerializerFor(Class<T> serializableClass, Class<? extends Serializer<T>> serializerClass, boolean overwrite) { if (serializableClass == null) { throw new NullPointerException("Serializable class cannot be null"); } if (serializerClass == null) { throw new NullPointerException("Serializer class cannot be null"); } boolean transientConstructorPresent; boolean persistentConstructorPresent; if(transientConstructorPresent = isConstructorPresent(serializerClass, ClassLoader.class)) { if (!overwrite && transientSerializers.containsKey(serializableClass)) { throw new IllegalArgumentException("Duplicate transient serializer for class : " + serializableClass.getName()); } else { transientSerializers.put(serializableClass, serializerClass); } } if (persistentConstructorPresent = isConstructorPresent(serializerClass, ClassLoader.class, StateRepository.class)) { if (!overwrite && persistentSerializers.containsKey(serializableClass)) { throw new IllegalArgumentException("Duplicate persistent serializer for class : " + serializableClass.getName()); } else { persistentSerializers.put(serializableClass, serializerClass); } } if (isConstructorPresent(serializerClass, ClassLoader.class, FileBasedPersistenceContext.class)) { if (persistentConstructorPresent) { throw new IllegalArgumentException("Serializer cannot have constructors taking (ClassLoader, StateRepository) and (ClassLoader, FileBasedPersistenceContext)" + " - you should remove the second one as it is deprecated since version 3.1.0"); } persistentConstructorPresent = true; if (!overwrite && persistentSerializers.containsKey(serializableClass)) { throw new IllegalArgumentException("Duplicate persistent serializer for class : " + serializableClass.getName()); } else { persistentSerializers.put(serializableClass, serializerClass); } } if(!transientConstructorPresent && !persistentConstructorPresent) { throw new IllegalArgumentException("The serializer: " + serializerClass.getName() + " does not meet the constructor requirements for either transient or persistent caches."); } return this; }