getAdditionalAttributes
getAdditionalAttributes()
getAdditionalAttributes 方法返回 Campaign 中定义的定制商品属性。
返回值
getAdditionalAttributes 方法返回一组 NameValuePair 对象。
示例
以下示例对所有其他属性进行排序,从而检查生效日期和截止日期,并打印出其他属性。
    for(NameValuePair offerAttribute : offer.getAdditionalAttributes())
{
// check to see if the effective date exists
if(offerAttribute.getName().equalsIgnoreCase("effectiveDate"))
{
System.out.println("Found effective date");
}
// check to see if the expiration date exists
else if(offerAttribute.getName().equalsIgnoreCase("expirationDate"))
{
System.out.println("Found expiration date");
}
printNameValuePair(offerAttribute);
}
}
public static void printNameValuePair(NameValuePair nvp)
{
// print out the name:
System.out.println("Name:"+nvp.getName());

// based on the datatype, call the appropriate method to get the value
if(nvp.getValueDataType()==NameValuePair.DATA_TYPE_DATETIME)
System.out.println("DateValue:"+nvp.getValueAsDate());
else if(nvp.getValueDataType()==NameValuePair.DATA_TYPE_NUMERIC)
System.out.println("NumericValue:"+nvp.getValueAsNumeric());
else
System.out.println("StringValue:"+nvp.getValueAsString());
}