org.simpleflatmapper.reflect.impl.JavaLangClassMetaFactoryProducer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-reflect Show documentation
Show all versions of sfm-reflect Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.simpleflatmapper.reflect.impl;
import org.simpleflatmapper.reflect.InstantiatorDefinition;
import org.simpleflatmapper.reflect.ReflectionService;
import org.simpleflatmapper.reflect.meta.ClassMeta;
import org.simpleflatmapper.reflect.meta.ConstructorPropertyMeta;
import org.simpleflatmapper.reflect.meta.ObjectClassMeta;
import org.simpleflatmapper.reflect.meta.PropertyMeta;
import org.simpleflatmapper.util.Consumer;
import org.simpleflatmapper.util.UnaryFactory;
import java.util.Collections;
public class JavaLangClassMetaFactoryProducer implements ReflectionService.ClassMetaFactoryProducer {
@Override
public void produce(Consumer super UnaryFactory>> consumer) {
predefined(String.class, consumer);
predefined(Boolean.class, consumer);
predefined(Byte.class, consumer);
predefined(Character.class, consumer);
predefined(Short.class, consumer);
predefined(Integer.class, consumer);
predefined(Long.class, consumer);
predefined(Float.class, consumer);
predefined(Double.class, consumer);
}
private void predefined(final Class target,
Consumer super UnaryFactory>> consumer) {
consumer.accept(new UnaryFactory>() {
@Override
public ClassMeta> newInstance(ReflectionService reflectionService) {
return new ObjectClassMeta(
target,
Collections.emptyList(),
Collections.>emptyList(),
Collections.emptyMap(),
Collections.>emptyList(),
reflectionService, false);
}
});
}
}