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

com.sap.cloud.security.ams.dcl.client.dcn.Use Maven / Gradle / Ivy

The newest version!
/************************************************************************
 * © 2019-2024 SAP SE or an SAP affiliate company. All rights reserved. *
 ************************************************************************/
package com.sap.cloud.security.ams.dcl.client.dcn;

import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;

import com.sap.cloud.security.ams.dcl.client.annotation.Beta;
import com.sap.cloud.security.ams.dcl.client.el.Call;
import com.sap.cloud.security.ams.dcl.client.el.QualifiedName;

@Beta
public class Use implements Annotated, PolicyMember {

    private QualifiedName qualifiedPolicyName;

    private List> restrictions;

    private Map annotations;

    private transient Object userData; // NOSONAR

    public QualifiedName qualifiedPolicyName() {
        return qualifiedPolicyName;
    }

    public Use qualifiedPolicyName(QualifiedName qualifiedPolicyName) {
        this.qualifiedPolicyName = qualifiedPolicyName;
        return this;
    }

    public List> restrictions() {
        return restrictions; // NOSONAR
    }

    public Use restrictions(List> restrictions) {
        this.restrictions = restrictions; // NOSONAR
        return this;
    }

    @Override
    public Map annotations() {
        return annotations; // NOSONAR
    }

    @Override
    public Use annotations(Map annotations) {
        this.annotations = annotations; // NOSONAR
        return this;
    }

    /**
     * Gets the custom user data. This data is not stored or loaded (i.e transient). The value is not take into account for hashCode() or
     * equals(Object other).
     * 
     * @return user data
     */
    public Object userData() {
        return userData;
    }

    /**
     * Sets the user data. This data is not stored or loaded (i.e transient). The value is not take into account for hashCode() or equals(Object
     * other).
     * 
     * @param userData
     *            custom user data
     * @return this
     */
    public Use userData(Object userData) {
        this.userData = userData;
        return this;
    }

    public Use apply(Consumer consumer) {
        consumer.accept(this);
        return this;
    }

    //

    @Override
    public String toString() {
        return "Use [qualifiedPolicyName=" + qualifiedPolicyName
                + ", restrictions=" + restrictions
                + ", annotations=" + annotations
                + "]";
    }

    @Override
    public int hashCode() {
        return Objects.hash(qualifiedPolicyName, restrictions, annotations);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Use other = (Use) obj;
        return Objects.equals(qualifiedPolicyName, other.qualifiedPolicyName)
                && Objects.equals(restrictions, other.restrictions)
                && Objects.equals(annotations, other.annotations);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy