private boolean textIsEmptyOrNull() { String t = text(); return null == t || 0 == t.length(); } }
/** * Converts the text of this GPathResult to a BigInteger object. * * @return the GPathResult, converted to a <code>BigInteger</code> */ public BigInteger toBigInteger() { if(textIsEmptyOrNull()){ return null; } return StringGroovyMethods.toBigInteger((CharSequence)text()); }
private boolean isEmptyElement(Node node) { if (node == null) { throw new IllegalArgumentException("Node must not be null!"); } if (!node.children().isEmpty()) { return false; } return node.text().length() == 0; }
/** * Converts the text of this GPathResult to a Double object. * * @return the GPathResult, converted to a <code>Double</code> */ public Double toDouble() { if(textIsEmptyOrNull()){ return null; } return StringGroovyMethods.toDouble((CharSequence)text()); }
text = (String) child; } else if (child instanceof Node) { text = ((Node) child).text();
/** * Converts the text of this GPathResult to a Float object. * * @return the GPathResult, converted to a <code>Float</code> */ public Float toFloat() { if(textIsEmptyOrNull()){ return null; } return StringGroovyMethods.toFloat((CharSequence)text()); }
childText = (String) child; } else if (child instanceof Node) { childText = ((Node) child).text();
/** * Converts the text of this GPathResult to a Integer object. * * @return the GPathResult, converted to a <code>Integer</code> */ public Integer toInteger() { if(textIsEmptyOrNull()){ return null; } return StringGroovyMethods.toInteger((CharSequence)text()); }
protected boolean printSpecialNode(Node node) { Object name = node.name(); if (name != null && name instanceof QName) { QName qn = (QName) name; // check uri and for legacy cases just check prefix name (not recommended) if (qn.getNamespaceURI().equals("http://groovy.codehaus.org/2005/gsp") || qn.getPrefix().equals("gsp")) { String s = qn.getLocalPart(); if (s.length() == 0) { throw new RuntimeException("No local part after 'gsp:' given in node " + node); } printGroovyTag(s, node.text()); return true; } } return false; } }
/** * Converts the text of this GPathResult to a Long object. * * @return the GPathResult, converted to a <code>Long</code> */ public Long toLong() { if(textIsEmptyOrNull()){ return null; } return StringGroovyMethods.toLong((CharSequence)text()); }
/** * Converts the text of this GPathResult to a BigDecimal object. * * @return the GPathResult, converted to a <code>BigDecimal</code> */ public BigDecimal toBigDecimal() { if(textIsEmptyOrNull()){ return null; } return StringGroovyMethods.toBigDecimal((CharSequence)text()); }
private static boolean isEmptyElement(Node node) { if (node == null) { throw new IllegalArgumentException("Node must not be null!"); } if (!node.children().isEmpty()) { return false; } return node.text().length() == 0; }
private boolean isEmptyElement(Node node) { if (node == null) { throw new IllegalArgumentException("Node must not be null!"); } if (!node.children().isEmpty()) { return false; } return node.text().length() == 0; }
private String findTextOfChild(Node node, String name) { Node child = findChild(node, name); return child == null ? null : child.text(); }
private boolean isEmptyElement(Node node) { if (node == null) { throw new IllegalArgumentException("Node must not be null!"); } if (!node.children().isEmpty()) { return false; } return node.text().length() == 0; }
private boolean isEmptyElement(Node node) { if (node == null) { throw new IllegalArgumentException("Node must not be null!"); } if (!node.children().isEmpty()) { return false; } return node.text().length() == 0; }
private boolean isEmptyElement(Node node) { if (node == null) { throw new IllegalArgumentException("Node must not be null!"); } if (!node.children().isEmpty()) { return false; } return node.text().length() == 0; }
@Nonnull private static String getXmlResultsField(Node xml, String field) { Node f1 = getFirstChild(getFirstChild(xml, "result"), field); if (f1==null) return ""; return f1.text(); } }
private static String getXmlResultsField(Node xml, String field) { Node r1 = ((Node)((NodeList)xml.get("result")).get(0)); Node f1 = ((Node)((NodeList)r1.get(field)).get(0)); return f1.text(); } }