use of gov.nist.core.NameValue in project XobotOS by xamarin.
the class ParametersHeader method setParameter.
/**
* Sets the value of the specified parameter. If the parameter already had
*
* a value it will be overwritten. A zero-length String indicates flag
*
* parameter.
*
*
*
* @param name - a String specifying the parameter name
*
* @param value - a String specifying the parameter value
*
* @throws ParseException which signals that an error has been reached
*
* unexpectedly while parsing the parameter name or value.
*
*/
public void setParameter(String name, String value) throws ParseException {
NameValue nv = parameters.getNameValue(name);
if (nv != null) {
nv.setValueAsObject(value);
} else {
nv = new NameValue(name, value);
this.parameters.set(nv);
}
}
use of gov.nist.core.NameValue in project XobotOS by xamarin.
the class ParametersHeader method setParameter.
/**
* Sets the value of the specified parameter. If the parameter already had
*
* a value it will be overwritten.
*
* @param name - a String specifying the parameter name
*
* @param value - a boolean specifying the parameter value
*
* @throws ParseException which signals that an error has been reached
*
* unexpectedly while parsing the parameter name or value.
*
*/
protected void setParameter(String name, float value) {
Float val = Float.valueOf(value);
NameValue nv = parameters.getNameValue(name);
if (nv != null) {
nv.setValueAsObject(val);
} else {
nv = new NameValue(name, val);
this.parameters.set(nv);
}
}
use of gov.nist.core.NameValue in project XobotOS by xamarin.
the class Via method setMAddr.
/**
* Sets the value of the <code>maddr</code> parameter of this ViaHeader. The
* maddr parameter indicates the server address to be contacted for this
* user, overriding any address derived from the host field.
*
* @param mAddr new value of the <code>maddr</code> parameter
* @throws ParseException which signals that an error has been reached
* unexpectedly while parsing the mAddr value.
*/
public void setMAddr(String mAddr) throws ParseException {
if (mAddr == null)
throw new NullPointerException("JAIN-SIP Exception, " + "Via, setMAddr(), the mAddr parameter is null.");
Host host = new Host();
host.setAddress(mAddr);
NameValue nameValue = new NameValue(ParameterNames.MADDR, host);
setParameter(nameValue);
}
use of gov.nist.core.NameValue in project XobotOS by xamarin.
the class PChargingFunctionAddresses method getEventChargingFunctionAddresses.
/**
* <p>Get all the Event Charging Function (ECF) Addresses set in this header</p>
*
* @return ListIterator that constains all CCF addresses of this header
*/
public ListIterator<NameValue> getEventChargingFunctionAddresses() {
LinkedList<NameValue> listw = new LinkedList<NameValue>();
Iterator li = this.parameters.iterator();
ListIterator<NameValue> ecfLIST = listw.listIterator();
NameValue nv;
boolean removed = false;
while (li.hasNext()) {
nv = (NameValue) li.next();
if (nv.getName().equalsIgnoreCase(ParameterNamesIms.ECF)) {
NameValue ecfNV = new NameValue();
ecfNV.setName(nv.getName());
ecfNV.setValueAsObject(nv.getValueAsObject());
ecfLIST.add(ecfNV);
}
}
return ecfLIST;
}
use of gov.nist.core.NameValue in project XobotOS by xamarin.
the class PChargingFunctionAddresses method delete.
/**
* <p>Remove parameter </p>
*
* @param value - of the parameter
* @param name - of the parameter
* @return true if parameter was removed, and false if not
*/
public boolean delete(String value, String name) {
Iterator li = this.parameters.iterator();
NameValue nv;
boolean removed = false;
while (li.hasNext()) {
nv = (NameValue) li.next();
if (((String) nv.getValueAsObject()).equalsIgnoreCase(value) && nv.getName().equalsIgnoreCase(name)) {
li.remove();
removed = true;
}
}
return removed;
}
Aggregations