public <T> void register(final Class<T> cls, final ToStringConverter<T> toString, final FromStringConverter<T> fromString) {
        if (fromString == null || toString == null) {
            throw new IllegalArgumentException("Converters must not be null");
        }
        register(cls, new TypedStringConverter<T>() {
            @Override
            public String convertToString(T object) {
                return toString.convertToString(object);
            }
            @Override
            public T convertFromString(Class<? extends T> cls, String str) {
                return fromString.convertFromString(cls, str);
            }
            @Override
            public Class<?> getEffectiveType() {
                return cls;
            }
        });
    }
public < T > void register ( final Class < T > cls , final ToStringConverter < T > toString , final FromStringConverter < T > fromString ) { if ( fromString == null || toString == null ) { throw new IllegalArgumentException ( "Converters must not be null" ) ; } register ( cls , new TypedStringConverter < T > ( ) { @ Override public String convertToString ( T object ) { return toString . convertToString ( object ) ; } @ Override public T convertFromString ( Class < ? extends T > cls , String str ) { return fromString . convertFromString ( cls , str ) ; } @ Override public Class < ? > getEffectiveType ( ) { return cls ; } } ) ; }
Registers a converter for a specific type using two separate converters.
<p>
This method registers a converter for the specified class.
It is primarily intended for use with JDK 1.8 method references or lambdas:
<pre>
sc.register(Distance.class, Distance::toString, Distance::parse);
</pre>
The converter will be used for subclasses unless overidden.
<p>
No new converters may be registered for the global singleton.

@param <T>  the type of the converter
@param cls  the class to register a converter for, not null
@param toString  the to String converter, typically a method reference, not null
@param fromString  the from String converter, typically a method reference, not null
@throws IllegalArgumentException if the class or converter are null
@throws IllegalStateException if trying to alter the global singleton
@since 1.3