All Downloads are FREE. Search and download functionalities are using the official Maven repository.

blah.tests.DefaultConverter Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
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