/** * Gets the adjustments for this attribute. If no adjustments are present, * an empty {@link Adjustments} object is created, linked to this attribute * and returned. * * @return the adjustments for this attribute. */ public Adjustments getAdjustments() { if (adjustments == null) { adjustments = new Adjustments(); } return adjustments; }
public boolean hasAdjustments() { return adjustments != null && !adjustments.isEmpty(); }
@Override public void processEndElement() { if (GoogleBaseNamespaces.GM_URI.equals(uri)) { if (GM_ADJUSTED_VALUE_ATTRIBUTE.equals(localName)) { attribute.getAdjustments().setValue(super.value); } else if (GM_ADJUSTED_NAME_ATTRIBUTE.equals(localName)) { attribute.getAdjustments().setName(super.value); } // if the uri is gm but the name is not recognized, we ignore it } else { // only non-gm uris are considered sub-elements attribute.appendSubElement(localName, super.value); } } };
/** * Generates XML code for the adjustments of the {@code attribute} * ({@code adjusted_value}, {@code adjusted_name}). * * @param attribute * @param xmlWriter * @throws IOException */ private void generateAdjustments(GoogleBaseAttribute attribute, XmlWriter xmlWriter) throws IOException { if (attribute.hasAdjustments()) { Adjustments adjustments = attribute.getAdjustments(); if (adjustments.getName() != null) { writeXmlNameValue(xmlWriter, GoogleBaseNamespaces.GM, GM_ADJUSTED_NAME_ATTRIBUTE, adjustments.getName()); } if (adjustments.getValue() != null) { writeXmlNameValue(xmlWriter, GoogleBaseNamespaces.GM, GM_ADJUSTED_VALUE_ATTRIBUTE, adjustments.getValue()); } } }
@Override public void processEndElement() { if (GoogleBaseNamespaces.GM_URI.equals(uri)) { if (GM_ADJUSTED_VALUE_ATTRIBUTE.equals(localName)) { attribute.getAdjustments().setValue(super.value); } else if (GM_ADJUSTED_NAME_ATTRIBUTE.equals(localName)) { attribute.getAdjustments().setName(super.value); } // if the uri is gm but the name is not recognized, we ignore it } else { // only non-gm uris are considered sub-elements attribute.appendSubElement(localName, super.value); } } };
/** * Generates XML code for the adjustments of the {@code attribute} * ({@code adjusted_value}, {@code adjusted_name}). * * @param attribute * @param xmlWriter * @throws IOException */ private void generateAdjustments(GoogleBaseAttribute attribute, XmlWriter xmlWriter) throws IOException { if (attribute.hasAdjustments()) { Adjustments adjustments = attribute.getAdjustments(); if (adjustments.getName() != null) { writeXmlNameValue(xmlWriter, GoogleBaseNamespaces.GM, GM_ADJUSTED_NAME_ATTRIBUTE, adjustments.getName()); } if (adjustments.getValue() != null) { writeXmlNameValue(xmlWriter, GoogleBaseNamespaces.GM, GM_ADJUSTED_VALUE_ATTRIBUTE, adjustments.getValue()); } } }
@Override public void processEndElement() { if (GoogleBaseNamespaces.GM_URI.equals(uri)) { if (GM_ADJUSTED_VALUE_ATTRIBUTE.equals(localName)) { attribute.getAdjustments().setValue(super.value); } else if (GM_ADJUSTED_NAME_ATTRIBUTE.equals(localName)) { attribute.getAdjustments().setName(super.value); } else if (GM_THUMBNAIL_ATTRIBUTE.equals(localName)) { Thumbnail thumbnail = new Thumbnail(); thumbnail.setUrl(super.value.trim()); if ((width > 0) && (height > 0)) { thumbnail.setSize(width, height); } attribute.getThumbnails().add(thumbnail); } // if the uri is gm but the name is not recognized, we ignore it } else { // only non-gm uris are considered sub-elements attribute.appendSubElement(localName, super.value); } }
/** * Gets the adjustments for this attribute. If no adjustments are present, * an empty {@link Adjustments} object is created, linked to this attribute * and returned. * * @return the adjustments for this attribute. */ public Adjustments getAdjustments() { if (adjustments == null) { adjustments = new Adjustments(); } return adjustments; }
public boolean hasAdjustments() { return adjustments != null && !adjustments.isEmpty(); }
@Override public void processEndElement() { if (GoogleBaseNamespaces.GM_URI.equals(uri)) { if (GM_ADJUSTED_VALUE_ATTRIBUTE.equals(localName)) { attribute.getAdjustments().setValue(super.value); } else if (GM_ADJUSTED_NAME_ATTRIBUTE.equals(localName)) { attribute.getAdjustments().setName(super.value); } else if (GM_THUMBNAIL_ATTRIBUTE.equals(localName)) { Thumbnail thumbnail = new Thumbnail(); thumbnail.setUrl(super.value.trim()); if ((width > 0) && (height > 0)) { thumbnail.setSize(width, height); } attribute.getThumbnails().add(thumbnail); } // if the uri is gm but the name is not recognized, we ignore it } else { // only non-gm uris are considered sub-elements attribute.appendSubElement(localName, super.value); } }