/** * Generates a string representation of this attribute. * * The output of this method is in no particular format. * @return a string representation */ @Override public String toString() { StringBuffer buf = new StringBuffer(); buf.append("["); buf.append(attributeId); buf.append(": "); if (hasValue()) { buf.append(textValue); } if (hasSubElements()) { buf.append(subElements.toString()); } if (hasSubAttributes()) { buf.append(subAttributes.toString()); } buf.append("]"); return buf.toString(); }
/** * Generates a string representation of this attribute. * * The output of this method is in no particular format. * @return a string representation */ @Override public String toString() { StringBuffer buf = new StringBuffer(); buf.append("["); buf.append(attributeId); buf.append(": "); if (hasValue()) { buf.append(textValue); } if (hasSubElements()) { buf.append(subElements.toString()); } if (hasSubAttributes()) { buf.append(subAttributes.toString()); } buf.append("]"); return buf.toString(); }
/** * Extracts a {@link Shipping} object from the value of a * {@link com.google.api.gbase.client.GoogleBaseAttribute}. * * @param attribute * @exception NumberFormatException if the conversion failed * because the price is missing or not a number. */ public static Shipping extractShipping(GoogleBaseAttribute attribute) { if (attribute.hasSubAttributes()) { return extractShippingFromAttributes(attribute); } else { return extractShippingFromElements(attribute); } }
/** * Extracts a {@link Tax} object from the value of a * {@link com.google.api.gbase.client.GoogleBaseAttribute}. * * @param attribute * @exception NumberFormatException if the conversion failed, usually * because the rate is missing or not a number. */ public static Tax extractTax(GoogleBaseAttribute attribute) { if (attribute.hasSubAttributes()) { return extractTaxFromAttributes(attribute); } else { return extractTaxFromElements(attribute); } }
/** * 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); } } }
/** * Extracts a {@link Tax} object from the value of a * {@link com.google.api.gbase.client.GoogleBaseAttribute}. * * @param attribute * @exception NumberFormatException if the conversion failed, usually * because the rate is missing or not a number. */ public static Tax extractTax(GoogleBaseAttribute attribute) { if (attribute.hasSubAttributes()) { return extractTaxFromAttributes(attribute); } else { return extractTaxFromElements(attribute); } }
/** * Extracts a {@link Shipping} object from the value of a * {@link com.google.api.gbase.client.GoogleBaseAttribute}. * * @param attribute * @exception NumberFormatException if the conversion failed * because the price is missing or not a number. */ public static Shipping extractShipping(GoogleBaseAttribute attribute) { if (attribute.hasSubAttributes()) { return extractShippingFromAttributes(attribute); } else { return extractShippingFromElements(attribute); } }
/** * 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); } } }