getAdditionalAttributes
getAdditionalAttributes()
The
getAdditionalAttributes
method returns the custom offer attributes defined in
Campaign
.
Return value
The
getAdditionalAttributes
method returns an array of NameValuePair objects.
Example
The following example sorts through all the additional attributes, checking for the effective date and expiration date, and printing out the other attributes.
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());
}
Copyright IBM Corporation 2013. All Rights Reserved.