Search in sources :

Example 6 with NameValue

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);
    }
}
Also used : NameValue(gov.nist.core.NameValue)

Example 7 with NameValue

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);
    }
}
Also used : NameValue(gov.nist.core.NameValue)

Example 8 with NameValue

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);
}
Also used : NameValue(gov.nist.core.NameValue) Host(gov.nist.core.Host)

Example 9 with 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;
}
Also used : NameValue(gov.nist.core.NameValue) Iterator(java.util.Iterator) ListIterator(java.util.ListIterator) LinkedList(java.util.LinkedList)

Example 10 with NameValue

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;
}
Also used : NameValue(gov.nist.core.NameValue) Iterator(java.util.Iterator) ListIterator(java.util.ListIterator)

Aggregations

NameValue (gov.nist.core.NameValue)18 Token (gov.nist.core.Token)3 Iterator (java.util.Iterator)3 ListIterator (java.util.ListIterator)3 ParseException (java.text.ParseException)2 LinkedList (java.util.LinkedList)2 Host (gov.nist.core.Host)1 HostNameParser (gov.nist.core.HostNameParser)1 HostPort (gov.nist.core.HostPort)1 NameValueList (gov.nist.core.NameValueList)1 SipUri (gov.nist.javax.sip.address.SipUri)1 PAccessNetworkInfo (gov.nist.javax.sip.header.ims.PAccessNetworkInfo)1