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

com.gemstone.org.jgroups.conf.ProtocolParameter Maven / Gradle / Ivy

There is a newer version: 2.0-BETA
Show newest version
/** Notice of modification as required by the LGPL
 *  This file was modified by Gemstone Systems Inc. on
 *  $Date$
 **/
// $Id: ProtocolParameter.java,v 1.4 2004/09/23 16:29:14 belaban Exp $

package com.gemstone.org.jgroups.conf;

/**
 * Data holder for protocol data
 *
 * @author Filip Hanik ([email protected])
 * @version 1.0
 */

public class ProtocolParameter {

    private final String mParameterName;
    private final Object mParameterValue;

    public ProtocolParameter(String parameterName,
                             Object parameterValue) {
        mParameterName=parameterName;
        mParameterValue=parameterValue;
    }

    public String getName() {
        return mParameterName;
    }

    public Object getValue() {
        return mParameterValue;
    }

    @Override // GemStoneAddition
    public int hashCode() {
        if(mParameterName != null)
            return mParameterName.hashCode();
        else
            return -1;
    }

    @Override // GemStoneAddition
    public boolean equals(Object another) {
        if(another instanceof ProtocolParameter)
            return getName().equals(((ProtocolParameter)another).getName());
        else
            return false;
    }

    public String getParameterString() {
        StringBuffer buf=new StringBuffer(mParameterName);
        if(mParameterValue != null)
            buf.append('=').append(mParameterValue.toString());
        return buf.toString();
    }

    public String getParameterStringXml() {
        StringBuffer buf=new StringBuffer(mParameterName);
        if(mParameterValue != null)
            buf.append("=\"").append(mParameterValue.toString()).append('\"');
        return buf.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy