public final class XmlMetaReader extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
XML_TAG_DESCRIPTION
Description tag of metadata XML files.
|
private static java.lang.String |
XML_TAG_NAME
Name tag of metadata XML files.
|
| Modifier | Constructor and Description |
|---|---|
private |
XmlMetaReader()
Do no allow
XmlMetaReader instances to be created. |
| Modifier and Type | Method and Description |
|---|---|
private static java.util.List<ModulePropertyDetails> |
createProperties(org.w3c.dom.Element properties)
Create module property details from the XML metadata.
|
private static java.lang.String |
getAttributeValue(org.w3c.dom.Element element,
java.lang.String attribute)
Utility to get attribute value of an element.
|
private static java.util.List<org.w3c.dom.Element> |
getDirectChildsByTag(org.w3c.dom.Element element,
java.lang.String sTagName)
Utility to get the children of an element by tag name.
|
private static java.util.List<java.lang.String> |
getListContentByAttribute(org.w3c.dom.Element element,
java.lang.String listParent,
java.lang.String listOption,
java.lang.String attribute)
Utility to get the list contents by the attribute specified.
|
private static void |
populateModule(org.w3c.dom.Element mod,
ModuleDetails moduleDetails)
Populate the module detail object from XML metadata.
|
static ModuleDetails |
read(java.io.InputStream moduleMetadataStream,
ModuleType moduleType)
Read the module details from the supplied input stream of the module's XML metadata file.
|
static java.util.List<ModuleDetails> |
readAllModulesIncludingThirdPartyIfAny(java.lang.String... thirdPartyPackages)
Utility to load all the metadata files present in the checkstyle JAR including third parties'
module metadata files.
|
private static final java.lang.String XML_TAG_NAME
private static final java.lang.String XML_TAG_DESCRIPTION
private XmlMetaReader()
XmlMetaReader instances to be created.public static java.util.List<ModuleDetails> readAllModulesIncludingThirdPartyIfAny(java.lang.String... thirdPartyPackages)
checkstylemeta-
to their file names.thirdPartyPackages - list of fully qualified third party package names(can be only a
hint, e.g. for SevNTU it can be com.github.sevntu / com.github)java.lang.IllegalStateException - if there was a problem reading the module metadata filespublic static ModuleDetails read(java.io.InputStream moduleMetadataStream, ModuleType moduleType) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
moduleMetadataStream - input stream object of a module's metadata filemoduleType - type of modulejavax.xml.parsers.ParserConfigurationException - if a parser configuration exception occursjava.io.IOException - if a IO exception occursorg.xml.sax.SAXException - if a SAX exception occurs during parsing the XML fileprivate static void populateModule(org.w3c.dom.Element mod, ModuleDetails moduleDetails)
mod - root XML document elementmoduleDetails - module detail object, which is to be updatedprivate static java.util.List<ModulePropertyDetails> createProperties(org.w3c.dom.Element properties)
properties - parent document element which contains property's metadataprivate static java.util.List<java.lang.String> getListContentByAttribute(org.w3c.dom.Element element, java.lang.String listParent, java.lang.String listOption, java.lang.String attribute)
element - doc elementlistParent - parent element of listlistOption - child list elementattribute - attribute keyprivate static java.util.List<org.w3c.dom.Element> getDirectChildsByTag(org.w3c.dom.Element element, java.lang.String sTagName)
element - parent elementsTagName - tag name of children requiredprivate static java.lang.String getAttributeValue(org.w3c.dom.Element element, java.lang.String attribute)
element - target elementattribute - attribute keyCopyright © 2001-2022. All Rights Reserved.