io.cloudslang.lang.entities.bindings.InOutParam Maven / Gradle / Ivy
/*******************************************************************************
* (c) Copyright 2016 Hewlett-Packard Development Company, L.P.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License v2.0 which accompany this distribution.
*
* The Apache License is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
*******************************************************************************/
package io.cloudslang.lang.entities.bindings;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.cloudslang.lang.entities.bindings.values.Value;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* @author moradi
* @version $Id$
* @since 13/11/204
*/
public abstract class InOutParam implements Serializable {
private static final long serialVersionUID = -7712676295781864973L;
private String name;
private Value value;
private Set functionDependencies;
private Set systemPropertyDependencies;
private Set variableSystemPropertyDependencies;
public InOutParam(
String name,
Value value,
Set functionDependencies,
Set systemPropertyDependencies) {
this(name, value, functionDependencies, systemPropertyDependencies, new HashSet<>());
}
public InOutParam(
String name,
Value value,
Set functionDependencies,
Set systemPropertyDependencies,
Set variableSystemPropertyDependencies) {
this.name = name;
this.value = value;
this.functionDependencies = functionDependencies;
this.systemPropertyDependencies = systemPropertyDependencies;
this.variableSystemPropertyDependencies = variableSystemPropertyDependencies;
}
public InOutParam(String name, Value value) {
this(name, value, new HashSet(), new HashSet());
}
/**
* only here to satisfy serialization libraries
*/
protected InOutParam() {
}
public String getName() {
return name;
}
public Value getValue() {
return value;
}
@JsonIgnore
public boolean isSensitive() {
return value != null && value.isSensitive();
}
public Set getFunctionDependencies() {
return functionDependencies;
}
public Set getSystemPropertyDependencies() {
return systemPropertyDependencies;
}
public Set getVariableSystemPropertyDependencies() {
return variableSystemPropertyDependencies;
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("name", name)
.append("value", value)
.append("functionDependencies", functionDependencies)
.append("systemPropertyDependencies", systemPropertyDependencies)
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InOutParam that = (InOutParam) o;
return new EqualsBuilder()
.append(name, that.name)
.append(value, that.value)
.append(functionDependencies, that.functionDependencies)
.append(systemPropertyDependencies, that.systemPropertyDependencies)
.append(variableSystemPropertyDependencies, that.variableSystemPropertyDependencies)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(name)
.append(value)
.append(functionDependencies)
.append(systemPropertyDependencies)
.append(variableSystemPropertyDependencies)
.toHashCode();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy