com.addc.commons.slp.IntegerAttributeValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of addc-slp Show documentation
Show all versions of addc-slp Show documentation
The addc-slp library supplies client classes for registering objects with a Service Location Protocol Daemon and
for looking theses objects up later.
package com.addc.commons.slp;
/**
*
* The IntegerAttributeValue supplies an attribute value containing an integer
*/
public class IntegerAttributeValue implements AttributeValue {
private final Integer value;
/**
* Create a new IntegerAttributeValue
* @param value the integer value
*/
public IntegerAttributeValue(int value) {
super();
this.value= value;
}
@Override
public Integer getValue() {
return value;
}
@Override
public String getClassName() {
return Integer.class.getSimpleName();
}
@Override
public String getEscapedString() {
StringBuilder sb= new StringBuilder();
sb.append(value).append(' ');
return sb.toString();
}
@Override
public int hashCode() {
final int prime= 31;
int result= 1;
result= prime * result + value.hashCode();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof IntegerAttributeValue)) {
return false;
}
IntegerAttributeValue other= (IntegerAttributeValue) obj;
if (!value.equals(other.value)) {
return false;
}
return true;
}
@Override
public String toString() {
StringBuilder builder= new StringBuilder();
builder.append(value);
return builder.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy