1 3 package org.jgroups.conf; 4 5 11 12 public class ProtocolParameter { 13 14 private final String mParameterName; 15 private final Object mParameterValue; 16 17 public ProtocolParameter(String parameterName, 18 Object parameterValue) { 19 mParameterName=parameterName; 20 mParameterValue=parameterValue; 21 } 22 23 public String getName() { 24 return mParameterName; 25 } 26 27 public Object getValue() { 28 return mParameterValue; 29 } 30 31 public int hashCode() { 32 if(mParameterName != null) 33 return mParameterName.hashCode(); 34 else 35 return -1; 36 } 37 38 public boolean equals(Object another) { 39 if(another instanceof ProtocolParameter) 40 return getName().equals(((ProtocolParameter)another).getName()); 41 else 42 return false; 43 } 44 45 public String getParameterString() { 46 StringBuffer buf=new StringBuffer (mParameterName); 47 if(mParameterValue != null) 48 buf.append('=').append(mParameterValue.toString()); 49 return buf.toString(); 50 } 51 52 public String getParameterStringXml() { 53 StringBuffer buf=new StringBuffer (mParameterName); 54 if(mParameterValue != null) 55 buf.append("=\"").append(mParameterValue.toString()).append('\"'); 56 return buf.toString(); 57 } 58 } 59 | Popular Tags |