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

org.vertexium.event.DeletePropertyEvent Maven / Gradle / Ivy

There is a newer version: 4.10.0
Show newest version
package org.vertexium.event;

import org.vertexium.Element;
import org.vertexium.Graph;
import org.vertexium.Property;
import org.vertexium.Visibility;
import org.vertexium.mutation.PropertyDeleteMutation;

public class DeletePropertyEvent extends GraphEvent {
    private final Element element;
    private final String key;
    private final String name;
    private final Visibility visibility;

    public DeletePropertyEvent(Graph graph, Element element, Property property) {
        super(graph);
        this.element = element;
        this.key = property.getKey();
        this.name = property.getName();
        this.visibility = property.getVisibility();
    }

    public DeletePropertyEvent(Graph graph, Element element, PropertyDeleteMutation propertyDeleteMutation) {
        super(graph);
        this.element = element;
        this.key = propertyDeleteMutation.getKey();
        this.name = propertyDeleteMutation.getName();
        this.visibility = propertyDeleteMutation.getVisibility();
    }

    public Element getElement() {
        return element;
    }

    public String getKey() {
        return key;
    }

    public String getName() {
        return name;
    }

    public Visibility getVisibility() {
        return visibility;
    }

    @Override
    public int hashCode() {
        return getKey().hashCode() ^ getName().hashCode() ^ getVisibility().hashCode();
    }

    @Override
    public String toString() {
        return "DeletePropertyEvent{element=" + getElement() + ", property=" + getKey() + ":" + getName() + ":" + getVisibility() + '}';
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof DeletePropertyEvent)) {
            return false;
        }

        DeletePropertyEvent other = (DeletePropertyEvent) obj;
        return getElement().equals(other.getElement())
                && getKey().equals(other.getKey())
                && getName().equals(other.getName())
                && getVisibility().equals(other.getVisibility())
                && super.equals(obj);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy