blah.tests.DefaultConverter Maven / Gradle / Ivy
package blah.tests;
import lombok.val;
import lombok.experimental.Delegate;
import lombok.experimental.ExtensionMethod;
import trip.spi.ServiceProvider;
import trip.spi.ServiceProviderException;
@SuppressWarnings( "unchecked" )
@ExtensionMethod( Commons.class )
public class DefaultConverter {
@Delegate
Converter converter;
public DefaultConverter( final Class targetClass ) throws ServiceProviderException {
this.converter = extractDefaultConverterFor( targetClass );
}
private Converter extractDefaultConverterFor( final Class targetClass ) throws ServiceProviderException {
val matcher = new GenericTypeMatcher( targetClass );
return new ServiceProvider().load( Converter.class, matcher );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy