org.simpleflatmapper.reflect.meta.IndexedElement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-reflect Show documentation
Show all versions of sfm-reflect Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.simpleflatmapper.reflect.meta;
import java.util.ArrayList;
import java.util.List;
public class IndexedElement {
private final PropertyMeta propertyMeta;
private final ClassMeta elementClassMeta;
private final PropertyFinder propertyFinder;
private final List assignedPath = new ArrayList();
public IndexedElement(PropertyMeta propertyMeta, ClassMeta elementClassMeta) {
this.propertyMeta = propertyMeta;
this.elementClassMeta = elementClassMeta;
if (elementClassMeta != null) {
propertyFinder = elementClassMeta.newPropertyFinder();
} else {
propertyFinder = null;
}
}
public PropertyMeta getPropertyMeta() {
return propertyMeta;
}
public ClassMeta getElementClassMeta() {
return elementClassMeta;
}
public PropertyFinder getPropertyFinder() {
return propertyFinder;
}
public void addProperty(PropertyMeta, ?> s) {
addProperty(s.getPath());
}
public void addProperty(String path) {
assignedPath.add(path);
}
public boolean hasProperty(PropertyMeta, ?> property) {
return hasProperty(property.getPath());
}
public boolean hasProperty(String path) {
return assignedPath.contains(path);
}
public boolean hasAnyProperty() {
return !assignedPath.isEmpty();
}
}