overflowdb.Element Maven / Gradle / Ivy
package overflowdb;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
public abstract class Element {
public abstract String label();
public abstract Graph graph();
public abstract Set propertyKeys();
public abstract Object property(String key);
public abstract A property(PropertyKey key);
public A property(String key, A defaultValue) {
Object value = property(key);
return value != null ? (A) value : defaultValue;
}
public A property(PropertyKey key, A defaultValue) {
Object value = property(key);
return value != null ? (A) value : defaultValue;
}
/** override this in specific element class, to define a default value */
public Object propertyDefaultValue(String propertyKey) {
return null;
}
public abstract Optional propertyOption(PropertyKey key);
public abstract Optional