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

org.simpleflatmapper.reflect.meta.PropertyMeta 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.meta;

import org.simpleflatmapper.reflect.Getter;
import org.simpleflatmapper.reflect.ReflectionService;
import org.simpleflatmapper.reflect.Setter;
import org.simpleflatmapper.util.Supplier;

import java.lang.reflect.Type;

/**
 *
 * @param  the type of the property owner
 * @param 

the type of the property */ public abstract class PropertyMeta { private final String name; private final Type ownerType; protected final ReflectionService reflectService; private volatile ClassMeta

classMeta; public PropertyMeta(String name, Type ownerType, ReflectionService reflectService) { this.name = name; this.ownerType = ownerType; this.reflectService = reflectService; } public abstract Setter getSetter(); public abstract Getter getGetter(); public final String getName() { return name; } public abstract Type getPropertyType(); public Type getOwnerType() { return ownerType; } public final ClassMeta

getPropertyClassMeta() { ClassMeta

meta = classMeta; if (meta == null) { meta = newPropertyClassMeta(); classMeta = meta; } return meta; } protected ClassMeta

newPropertyClassMeta() { return reflectService.getClassMeta(getPropertyType()); } public boolean isConstructorProperty() { return false; } public abstract String getPath(); public boolean isSubProperty() { return false; } public boolean isSelf() { return false; } public boolean isValid() { return true; } public final ReflectionService getReflectService () { return reflectService; } public Supplier> getPropertyClassMetaSupplier() { return new Supplier>() { @Override public ClassMeta

get() { return getPropertyClassMeta(); } }; } public Object[] getDefinedProperties() { return new Object[0]; } public abstract PropertyMeta withReflectionService(ReflectionService reflectionService); public int typeAffinityScore(PropertyFinder.TypeAffinityScorer typeAffinityScorer) { return typeAffinityScorer.score(getPropertyType()); } public boolean isNonMapped() { return false; } public abstract PropertyMeta toNonMapped(); public PropertyMeta compressSubSelf() { return this; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy