org.simpleflatmapper.reflect.meta.IndexedElement Maven / Gradle / Ivy
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();
}
}