/** * Helper function for making empty strings into a null. * * @return null if s is zero length. otherwise, returns s. */ public static String toNullIfEmpty(String s) { return (StringUtil.isEmpty(s)) ? null : s; }
/** * Helper function for making empty strings into a null. * * @return null if s is zero length. otherwise, returns s. */ public static String toNullIfEmpty(String s) { return (StringUtil.isEmpty(s)) ? null : s; }
/** * Helper function for making empty strings into a null. * * @return null if s is zero length. otherwise, returns s. */ public static String toNullIfEmpty(String s) { return (StringUtil.isEmpty(s)) ? null : s; }
/** * Returns {@code true} if there is no content element for this text content. */ public boolean isEmpty() { return StringUtil.isEmpty(getText()) && getElementCount() == 0; }
/** * Returns {@code true} if there is no content element for this text content. */ public boolean isEmpty() { return StringUtil.isEmpty(getText()) && getElementCount() == 0; }
/** * Returns {@code true} if there is no content element for this text content. */ public boolean isEmpty() { return StringUtil.isEmpty(getText()) && getElementCount() == 0; }
/** * @deprecated use {@link #getParentLinks()} instead. */ @Deprecated public Set<String> getFolders() { Set<String> folders = new HashSet<String>(); for (Category category : this.getCategories()) { Matcher matcher = FOLDER_PATTERN.matcher(category.getScheme()); if (matcher.matches()) { String folderName = category.getLabel(); if (StringUtil.isEmpty(folderName)) { folderName = category.getTerm(); } folders.add(folderName); } } return folders; }
private static QName createQName( String qName, String nsUri, String localName) { XmlNamespace ns = null; if (!StringUtil.isEmpty(nsUri)) { String[] parts = qName.split(":"); if (parts.length == 2) { ns = new XmlNamespace(parts[0], nsUri); } else { ns = new XmlNamespace(null, nsUri); } } return new QName(ns, localName); } }
/** * @deprecated use {@link #getParentLinks()} instead. */ @Deprecated public Set<String> getFolders() { Set<String> folders = new HashSet<String>(); for (Category category : this.getCategories()) { Matcher matcher = FOLDER_PATTERN.matcher(category.getScheme()); if (matcher.matches()) { String folderName = category.getLabel(); if (StringUtil.isEmpty(folderName)) { folderName = category.getTerm(); } folders.add(folderName); } } return folders; }
private static QName createQName( String qName, String nsUri, String localName) { XmlNamespace ns = null; if (!StringUtil.isEmpty(nsUri)) { String[] parts = qName.split(":"); if (parts.length == 2) { ns = new XmlNamespace(parts[0], nsUri); } else { ns = new XmlNamespace(null, nsUri); } } return new QName(ns, localName); } }
private static QName createQName( String qName, String nsUri, String localName) { XmlNamespace ns = null; if (!StringUtil.isEmpty(nsUri)) { String[] parts = qName.split(":"); if (parts.length == 2) { ns = new XmlNamespace(parts[0], nsUri); } else { ns = new XmlNamespace(null, nsUri); } } return new QName(ns, localName); } }
/** * @deprecated Do not use. (Currently only needed internally by * UriParameterMap.) */ @Deprecated public static void parseWithCallback(String str, String encoding, Callback callback) { if (StringUtil.isEmpty(str)) { return; } Result result = new Result(encoding); parser.parse(str, result); for (Parameter param : result.params) { callback.handleParameter(param.name, param.value); } }
/** * @deprecated Do not use. (Currently only needed internally by * UriParameterMap.) */ @Deprecated public static void parseWithCallback(String str, String encoding, Callback callback) { if (StringUtil.isEmpty(str)) { return; } Result result = new Result(encoding); parser.parse(str, result); for (Parameter param : result.params) { callback.handleParameter(param.name, param.value); } }
/** * @deprecated Do not use. (Currently only needed internally by * UriParameterMap.) */ @Deprecated public static void parseWithCallback(String str, String encoding, Callback callback) { if (StringUtil.isEmpty(str)) { return; } Result result = new Result(encoding); parser.parse(str, result); for (Parameter param : result.params) { callback.handleParameter(param.name, param.value); } }
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); }