public Group(Collection<GoogleBaseAttribute> subAttributes) { this.subAttributes = HashMultimap.<String, GoogleBaseAttribute>create(); for (GoogleBaseAttribute attr : subAttributes) { this.subAttributes.put(attr.getName(), attr); } }
public Group(Collection<GoogleBaseAttribute> subAttributes) { this.subAttributes = HashMultimap.<String, GoogleBaseAttribute>create(); for (GoogleBaseAttribute attr : subAttributes) { this.subAttributes.put(attr.getName(), attr); } }
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); }
String service = null; for (GoogleBaseAttribute attr : attribute.getSubAttributes()) { String name = attr.getName(); if (ShippingField.Country.getAttrName().equals(name)) { country = attr.getValueAsString();
String service = null; for (GoogleBaseAttribute attr : attribute.getSubAttributes()) { String name = attr.getName(); if (ShippingField.Country.getAttrName().equals(name)) { country = attr.getValueAsString();