org.sfm.reflect.meta.PropertyMeta Maven / Gradle / Ivy
Show all versions of simpleFlatMapper Show documentation
package org.sfm.reflect.meta;
import org.sfm.reflect.Getter;
import org.sfm.reflect.ReflectionService;
import org.sfm.reflect.Setter;
import java.lang.reflect.Type;
public abstract class PropertyMeta {
private final String name;
protected final ReflectionService reflectService;
private volatile Setter setter;
private volatile Getter getter;
private volatile ClassMeta classMeta;
public PropertyMeta(String name, ReflectionService reflectService) {
this.name = name;
this.reflectService = reflectService;
}
public final Setter getSetter() {
Setter lSetter = setter;
if (lSetter == null) {
lSetter = newSetter();
setter = lSetter;
}
return lSetter;
}
public final Getter getGetter() {
Getter lGetter = getter;
if (lGetter == null) {
lGetter = newGetter();
getter = lGetter;
}
return lGetter;
}
protected abstract Setter newSetter();
protected abstract Getter newGetter();
public final String getName() {
return name;
}
public abstract Type getType();
public final ClassMeta getClassMeta() {
ClassMeta
meta = classMeta;
if (meta == null) {
meta = newClassMeta();
classMeta = meta;
}
return meta;
}
protected ClassMeta
newClassMeta() {
return reflectService.getClassMeta(getType());
}
public boolean isConstructorProperty() {
return false;
}
public abstract String getPath();
public boolean isSubProperty() {
return false;
}
}