com.sap.cloud.security.ams.dcl.client.dcn.Function 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.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.QualifiedName;
@Beta
public class Function implements Annotated {
private QualifiedName qualifiedName;
private boolean internal;
private DataType returnType;
private Object result;
private Map annotations;
private transient Object userData; // NOSONAR
public QualifiedName qualifiedName() {
return qualifiedName;
}
public Function qualifiedName(QualifiedName qualifiedName) {
this.qualifiedName = qualifiedName;
return this;
}
public boolean internal() {
return internal;
}
public Function internal(boolean internal) {
this.internal = internal;
return this;
}
public DataType returnType() {
return returnType;
}
public Function returnType(DataType returnType) {
this.returnType = returnType;
return this;
}
public Object result() {
return result;
}
public Function result(Object result) {
this.result = result;
return this;
}
@Override
public Map annotations() {
return annotations; // NOSONAR
}
@Override
public Function 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 Function userData(Object userData) {
this.userData = userData;
return this;
}
public Function apply(Consumer consumer) {
consumer.accept(this);
return this;
}
//
@Override
public String toString() {
return "Function [qualifiedName=" + qualifiedName + ", internal=" + internal + ", returnType=" + returnType
+ ", result=" + result + ", annotations=" + annotations + "]";
}
@Override
public int hashCode() {
return Objects.hash(qualifiedName, internal, returnType, result, annotations);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Function other = (Function) obj;
return Objects.equals(qualifiedName, other.qualifiedName)
&& internal == other.internal
&& returnType == other.returnType
&& Objects.equals(result, other.result)
&& Objects.equals(annotations, other.annotations);
}
}