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

org.simpleflatmapper.reflect.impl.JavaLangClassMetaFactoryProducer Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 9.0.2
Show newest version
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>> 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>> 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);
            }
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy