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

org.simpleflatmapper.map.impl.DiscriminatorClassMeta 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.map.impl;

import org.simpleflatmapper.reflect.InstantiatorDefinition;
import org.simpleflatmapper.reflect.ReflectionService;
import org.simpleflatmapper.reflect.meta.ClassMeta;
import org.simpleflatmapper.reflect.meta.PropertyFinder;
import org.simpleflatmapper.reflect.meta.PropertyMeta;
import org.simpleflatmapper.util.Consumer;

import java.lang.reflect.Type;
import java.util.List;

public class DiscriminatorClassMeta implements ClassMeta {
    private final ReflectionService reflectionService;
    private final List> discriminator;
    private final Type commonType;

    public DiscriminatorClassMeta(Type commonType, List> discriminator, ReflectionService reflectionService) {
        this.discriminator = discriminator;
        this.reflectionService = reflectionService;
        this.commonType = commonType;
    }

    @Override
    public ReflectionService getReflectionService() {
        return reflectionService;
    }

    @Override
    public PropertyFinder newPropertyFinder() {
        return new DiscriminatorPropertyFinder(reflectionService.selfScoreFullName(), commonType, discriminator, reflectionService);
    }

    @Override
    public Type getType() {
        return commonType;
    }

    @Override
    public List getInstantiatorDefinitions() {
        return null;
    }

    @Override
    public void forEachProperties(Consumer> consumer) {
        throw new UnsupportedOperationException();
    }

    @Override
    public int getNumberOfProperties() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean needTransformer() {
        return true;
    }

    @Override
    public ClassMeta withReflectionService(ReflectionService reflectionService) {
        return new DiscriminatorClassMeta(commonType, discriminator, reflectionService);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy