org.simpleflatmapper.map.impl.DiscriminatorClassMeta Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-map Show documentation
Show all versions of sfm-map Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
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 super PropertyMeta> 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);
}
}