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

org.securegraph.property.MutableProperty Maven / Gradle / Ivy

The newest version!
package org.securegraph.property;

import org.securegraph.Metadata;
import org.securegraph.Property;
import org.securegraph.Visibility;

public abstract class MutableProperty extends Property {
    public abstract void setValue(Object value);

    public abstract void setVisibility(Visibility visibility);

    public abstract void addHiddenVisibility(Visibility visibility);

    public abstract void removeHiddenVisibility(Visibility visibility);

    protected abstract void addMetadata(String key, Object value, Visibility visibility);

    protected abstract void removeMetadata(String key, Visibility visibility);

    public void update(Property property) {
        if (property.getHiddenVisibilities() != null) {
            for (Visibility v : property.getHiddenVisibilities()) {
                addHiddenVisibility(v);
            }
        }

        setValue(property.getValue());

        for (Metadata.Entry m : property.getMetadata().entrySet()) {
            if (m.getValue() == null) {
                removeMetadata(m.getKey(), m.getVisibility());
            } else {
                addMetadata(m.getKey(), m.getValue(), m.getVisibility());
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy