public class SpringUtil extends Object
Constructor and Description |
---|
SpringUtil() |
Modifier and Type | Method and Description |
---|---|
static Element |
getChildElement(Element parent,
String ns,
String localName)
Get the first child element matching the local name and namespace
|
static List<Element> |
getChildElements(Element elm)
Get all child elements for the element
|
static String |
getChildElementText(Element parent,
String ns,
String localName)
Get the text context of first child element matching the local name and
namespace
|
static boolean |
parseBoolean(Element parent,
String attrName,
boolean defaultValue)
Parses a attribute value into a boolean.
|
static File |
parseFile(Element parent,
String attrName)
Return an attribute value as a
File |
static InetAddress |
parseInetAddress(Element parent,
String attrName)
Return an attribute value as an
InetAddress |
static int |
parseInt(Element parent,
String attrName)
Parses a attribute value into an integer.
|
static int |
parseInt(Element parent,
String attrName,
int defaultValue)
Parses a attribute value into an integer.
|
static Object |
parseSpringChildElement(Element parent,
org.springframework.beans.factory.xml.ParserContext parserContext,
org.springframework.beans.factory.support.BeanDefinitionBuilder builder)
Parse specific Spring elements, bean and ref
|
static String |
parseString(Element parent,
String attrName)
Return the string value of an attribute, or null if the attribute is
missing
|
static String |
parseStringFromInetAddress(Element parent,
String attrName)
Return an attribute value after checking it is a valid
InetAddress |
public static List<Element> getChildElements(Element elm)
elm
- The element for which to locate childrenpublic static Element getChildElement(Element parent, String ns, String localName)
parent
- The element for which to locate the childns
- The namespace to match, or null for any namespacelocalName
- The local name to match, or null for any local namepublic static String getChildElementText(Element parent, String ns, String localName)
parent
- The element for which to locate the childns
- The namespace to match, or null for any namespacelocalName
- The local name to match, or null for any local namepublic static Object parseSpringChildElement(Element parent, org.springframework.beans.factory.xml.ParserContext parserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder builder)
parent
- The element in which we will look for Spring elementsparserContext
- The Spring parser contextbuilder
- The Spring bean definition builderpublic static boolean parseBoolean(Element parent, String attrName, boolean defaultValue)
parent
- The elementattrName
- The attribute namedefaultValue
- The default valuepublic static int parseInt(Element parent, String attrName)
parent
- The elementattrName
- The attribute nameNumberFormatException
- If the attribute does not contain a numberpublic static int parseInt(Element parent, String attrName, int defaultValue)
parent
- The elementattrName
- The attribute namedefaultValue
- The default valuepublic static String parseString(Element parent, String attrName)
parent
- The elementattrName
- The attribute namepublic static File parseFile(Element parent, String attrName)
File
parent
- The elementattrName
- The attribute namepublic static InetAddress parseInetAddress(Element parent, String attrName)
InetAddress
parent
- The elementattrName
- The attribute nameInetAddress
public static String parseStringFromInetAddress(Element parent, String attrName)
InetAddress
parent
- The elementattrName
- The attribute nameCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.