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

com.addc.commons.slp.BooleanAttributeValue 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 BooleanAttributeValue supplies an attribute value containing a Boolean
 */
public class BooleanAttributeValue implements AttributeValue {
    private final Boolean value;
    
    /**
     * Create a new BooleanAttributeValue
     * @param value The boolean value
     */
    public BooleanAttributeValue(boolean value) {
        super();
        this.value= value;
    }

    @Override
    public Boolean getValue() {
        return value;
    }

    @Override
    public String getClassName() {
        return Boolean.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 BooleanAttributeValue)) {
            return false;
        }
        BooleanAttributeValue other= (BooleanAttributeValue) 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