public Object getValueAsObject() { return getValueAsObject(true); }
/** Returns the value of the <code>maddr</code> parameter, or null if this * is not set. This is equivalent to getParameter("maddr"). * * @return the value of the <code>maddr</code> parameter */ public String getMAddrParam() { NameValue maddr = uriParms.getNameValue(MADDR); if (maddr == null) return null; String host = (String) maddr.getValueAsObject(); return host; }
/** * Do a lookup on a given name and return value associated with it. */ public Object getValue(String name, boolean stripQuotes) { NameValue nv = this.getNameValue(name.toLowerCase()); if (nv != null) return nv.getValueAsObject(stripQuotes); else return null; }
/** Determines if this attribute has an associated value. * @throws SdpParseException if the value is not well formatted. * @return true if the attribute has a value. */ public boolean hasValue() throws SdpParseException { NameValue nameValue = getAttribute(); if (nameValue == null) return false; else { Object value = nameValue.getValueAsObject(); if (value == null) return false; else return true; } }
/** Returns the value of this attribute. * @throws SdpParseException if the value is not well formatted. * @return the value; null if the attribute has no associated value. */ public String getValue() throws SdpParseException { NameValue nameValue = getAttribute(); if (nameValue == null) return null; else { Object value = nameValue.getValueAsObject(); if (value == null) return null; else if (value instanceof String) return (String) value; else return value.toString(); } }
/** * <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; }
public boolean equals(Object that ) { if ( ! (that instanceof AttributeField)) return false; AttributeField other = (AttributeField) that; return other.getAttribute().getName().equalsIgnoreCase(this.getAttribute().getName()) && this.getAttribute().getValueAsObject().equals(other.getAttribute().getValueAsObject()); }
/** * Returns the value of the specified attribute. * * @param name * the name of the attribute. * @throws SdpParseException * @return the value of the named attribute */ public String getAttribute(String name) throws SdpParseException { if (name != null) { for (int i = 0; i < this.attributeFields.size(); i++) { AttributeField af = (AttributeField) this.attributeFields .elementAt(i); if (name.equals(af.getAttribute().getName())) return (String) af.getAttribute().getValueAsObject(); } return null; } else throw new NullPointerException("null arg!"); }
/** * <p>Get all the Charging Collection Function (CCF) Addresses set in this header</p> * * @return ListIterator that constains all CCF addresses of this header */ public ListIterator getChargingCollectionFunctionAddresses() { Iterator li = this.parameters.iterator(); LinkedList ccfLIST = new LinkedList(); NameValue nv; while (li.hasNext()) { nv = (NameValue) li.next(); if (nv.getName().equalsIgnoreCase(ParameterNamesIms.CCF)) { NameValue ccfNV = new NameValue(); ccfNV.setName(nv.getName()); ccfNV.setValueAsObject(nv.getValueAsObject()); ccfLIST.add(ccfNV); } } return ccfLIST.listIterator(); }
/** * <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; }
public BandwidthField bandwidthField() throws ParseException { try { this.lexer.match('b'); this.lexer.SPorHT(); this.lexer.match('='); this.lexer.SPorHT(); BandwidthField bandwidthField = new BandwidthField(); NameValue nameValue = nameValue(':'); String name = nameValue.getName(); String value = (String) nameValue.getValueAsObject(); bandwidthField.setBandwidth(Integer.parseInt(value.trim())); bandwidthField.setBwtype(name); this.lexer.SPorHT(); return bandwidthField; } catch (Exception e) { e.printStackTrace(); throw new ParseException(lexer.getBuffer(), lexer.getPtr()); } }
protected void parseNameValueList(ParametersHeader parametersHeader) throws ParseException{ parametersHeader.removeParameters(); while (true) { this.lexer.SPorHT(); NameValue nv = nameValue(); parametersHeader.setParameter(nv.getName(), (String) nv.getValueAsObject()); // eat white space this.lexer.SPorHT(); if (lexer.lookAhead(0) != ';') break; else lexer.consume(1); } } }
protected void parseNameValueList(ParametersHeader parametersHeader) throws ParseException{ parametersHeader.removeParameters(); while (true) { this.lexer.SPorHT(); NameValue nv = nameValue(); parametersHeader.setParameter(nv.getName(), (String) nv.getValueAsObject()); // eat white space this.lexer.SPorHT(); if (lexer.lookAhead(0) != ';') break; else lexer.consume(1); } } }
keyField.setKeyData((String) nameValue.getValueAsObject()); this.lexer.SPorHT();
String name = nameValue.getName(); if (name.equals(Via.BRANCH)) { String branchId = (String) nameValue.getValueAsObject(); if (branchId == null) throw new ParseException("null branch Id", lexer.getPtr());
String name = nameValue.getName(); if (name.equals(Via.BRANCH)) { String branchId = (String) nameValue.getValueAsObject(); if (branchId == null) throw new ParseException("null branch Id", lexer.getPtr());