本文整理汇总了Java中gov.nist.javax.sdp.fields.AttributeField.getName方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeField.getName方法的具体用法?Java AttributeField.getName怎么用?Java AttributeField.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nist.javax.sdp.fields.AttributeField
的用法示例。
在下文中一共展示了AttributeField.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttribute
import gov.nist.javax.sdp.fields.AttributeField; //导入方法依赖的package包/类
/**
* Returns the value of the specified attribute.
*
* @param name 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)
return null;
else if (attributesList == null) return null;
for (int i = 0; i < attributesList.size(); i++) {
Object o = attributesList.elementAt(i);
if (o instanceof AttributeField) {
AttributeField a = (AttributeField) o;
String n = a.getName();
if (n != null) {
if (name.equals(n)) {
return a.getValue();
}
}
}
}
return null;
}
示例2: removeAttribute
import gov.nist.javax.sdp.fields.AttributeField; //导入方法依赖的package包/类
/**
* Removes the attribute specified by the value parameter.
*
* @param name name - the name of the attribute
*/
public void removeAttribute(String name) {
if (name != null) if (attributesList != null) {
for (int i = 0; i < attributesList.size(); i++) {
Object o = attributesList.elementAt(i);
if (o instanceof AttributeField) {
AttributeField a = (AttributeField) o;
try {
String n = a.getName();
if (n != null) {
if (name.equals(n)) {
attributesList.remove(a);
}
}
} catch (SdpParseException e) {}
}
}
}
}
示例3: setAttribute
import gov.nist.javax.sdp.fields.AttributeField; //导入方法依赖的package包/类
/**
* Sets the value of the specified attribute.
*
* @param name name - the name of the attribute.
* @param value value - the value of the named attribute.
* @throws SdpException if the name or the value is null
*/
public void setAttribute(String name, String value) throws SdpException {
if (name == null || value == null)
throw new SdpException("The parameter is null");
else if (attributesList != null) {
for (int i = 0; i < attributesList.size(); i++) {
Object o = attributesList.elementAt(i);
if (o instanceof AttributeField) {
AttributeField a = (AttributeField) o;
String n = a.getName();
if (n != null) {
if (name.equals(n)) {
a.setValue(value);
}
}
}
}
}
}