List of usage examples for org.springframework.core.convert.converter Converter getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.grails.datastore.mapping.simpledb.model.types.SimpleDBTypeConverterRegistrar.java
protected void overwrite(ConverterRegistry registry, @SuppressWarnings("rawtypes") Converter converter) { //get type info for the specified converter GenericConverter.ConvertiblePair typeInfo = getRequiredTypeInfo(converter, Converter.class); if (typeInfo == null) { throw new IllegalArgumentException("Unable to the determine sourceType <S> and targetType <T> which " + "your Converter<S, T> converts between; declare these generic types. Converter class: " + converter.getClass().getName()); }/*from w ww .j a va2 s . co m*/ //now remove converters that we will overwrite for SimpleDB registry.removeConvertible(typeInfo.getSourceType(), typeInfo.getTargetType()); //now add registry.addConverter(converter); }
From source file:org.springframework.data.document.mongodb.convert.MappingMongoConverter.java
/** * Inspects the given {@link Converter} for the types it can convert and registers the pair for custom type conversion * in case the target type is a Mongo basic type. * * @param converter/*from ww w .ja v a 2s .c o m*/ */ private void registerConverter(Converter<?, ?> converter) { Class<?>[] arguments = GenericTypeResolver.resolveTypeArguments(converter.getClass(), Converter.class); if (MONGO_TYPES.contains(arguments[1]) || MONGO_TYPES.contains(arguments[0])) { customTypeMapping.add(new ConvertiblePair(arguments[0], arguments[1])); } conversionService.addConverter(converter); }