/** * Appends the value to the subAttribute list. */ public void addSubAttribute(GoogleBaseAttribute value) { getSubAttributes().add(value); }
/** * Appends the value to the subAttribute list. */ public void addSubAttribute(GoogleBaseAttribute value) { getSubAttributes().add(value); }
/** * Extracts a {@link Group} object from the value of a * {@link com.google.api.gbase.client.GoogleBaseAttribute}. * * @param attribute */ public static Group extractGroup(GoogleBaseAttribute attribute) { return new Group(attribute.getSubAttributes()); }
/** * Extracts a {@link Group} object from the value of a * {@link com.google.api.gbase.client.GoogleBaseAttribute}. * * @param attribute */ public static Group extractGroup(GoogleBaseAttribute attribute) { return new Group(attribute.getSubAttributes()); }
/** * Generates XML code for all sub-attributes of the {@code attribute}. * * @param attribute * @param xmlWriter * @throws IOException */ private void generateSubAttributes(GoogleBaseAttribute attribute, XmlWriter xmlWriter) throws IOException { if (attribute.hasSubAttributes()) { for (GoogleBaseAttribute element : attribute.getSubAttributes()) { generateAttribute(element, xmlWriter); } } }
/** * Generates XML code for all sub-attributes of the {@code attribute}. * * @param attribute * @param xmlWriter * @throws IOException */ private void generateSubAttributes(GoogleBaseAttribute attribute, XmlWriter xmlWriter) throws IOException { if (attribute.hasSubAttributes()) { for (GoogleBaseAttribute element : attribute.getSubAttributes()) { generateAttribute(element, xmlWriter); } } }
private static Tax extractTaxFromAttributes(GoogleBaseAttribute attribute) { String rateString = null; String country = null; Collection<String> regions = new ArrayList<String>(); Boolean taxShip = null; for (GoogleBaseAttribute attr : attribute.getSubAttributes()) { String name = attr.getName(); if (TaxField.Country.getAttrName().equals(name)) { country = attr.getValueAsString(); } else if (TaxField.Region.getAttrName().equals(name)) { regions.add(attr.getValueAsString()); } else if (TaxField.Rate.getAttrName().equals(name)) { rateString = attr.getValueAsString(); } else if (TaxField.TaxShip.getAttrName().equals(name)) { String taxShipString = attr.getValueAsString(); if (taxShipString != null) { taxShip = Boolean.valueOf(taxShipString); } } else { throw new IllegalArgumentException("Sub-attribute " + name + " is not supported in Tax."); } } if (StringUtil.isEmpty(rateString)) { throw new NumberFormatException( "missing 'rate' element in tax attribute: " + attribute); } float rate = Float.valueOf(rateString.trim()).floatValue(); return new Tax(country, regions, rate, taxShip); }
private static Tax extractTaxFromAttributes(GoogleBaseAttribute attribute) { String rateString = null; String country = null; Collection<String> regions = new ArrayList<String>(); Boolean taxShip = null; for (GoogleBaseAttribute attr : attribute.getSubAttributes()) { String name = attr.getName(); if (TaxField.Country.getAttrName().equals(name)) { country = attr.getValueAsString(); } else if (TaxField.Region.getAttrName().equals(name)) { regions.add(attr.getValueAsString()); } else if (TaxField.Rate.getAttrName().equals(name)) { rateString = attr.getValueAsString(); } else if (TaxField.TaxShip.getAttrName().equals(name)) { String taxShipString = attr.getValueAsString(); if (taxShipString != null) { taxShip = Boolean.valueOf(taxShipString); } } else { throw new IllegalArgumentException("Sub-attribute " + name + " is not supported in Tax."); } } if (StringUtil.isEmpty(rateString)) { throw new NumberFormatException( "missing 'rate' element in tax attribute: " + attribute); } float rate = Float.valueOf(rateString.trim()).floatValue(); return new Tax(country, regions, rate, taxShip); }
Collection<String> regions = new ArrayList<String>();; String service = null; for (GoogleBaseAttribute attr : attribute.getSubAttributes()) { String name = attr.getName(); if (ShippingField.Country.getAttrName().equals(name)) {
Collection<String> regions = new ArrayList<String>();; String service = null; for (GoogleBaseAttribute attr : attribute.getSubAttributes()) { String name = attr.getName(); if (ShippingField.Country.getAttrName().equals(name)) {