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

com.addc.commons.slp.IntegerAttributeValue Maven / Gradle / Ivy

Go to download

The addc-slp library supplies client classes for registering objects with a Service Location Protocol Daemon and for looking theses objects up later.

There is a newer version: 2.6
Show newest version
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