if ( finishedConfiguration.getChildCount() == 0 )
/** * Copy constructor with alternative name. */ public Xpp3Dom( Xpp3Dom src, String name ) { this.name = name; int childCount = src.getChildCount(); childList = new ArrayList<Xpp3Dom>( childCount ); childMap = new HashMap<String, Xpp3Dom>( childCount << 1 ); setValue( src.getValue() ); String[] attributeNames = src.getAttributeNames(); for ( String attributeName : attributeNames ) { setAttribute( attributeName, src.getAttribute( attributeName ) ); } for ( int i = 0; i < childCount; i++ ) { addChild( new Xpp3Dom( src.getChild( i ) ) ); } }
if ( recessive.getChildCount() > 0 ) for ( int i = 0, recessiveChildCount = recessive.getChildCount(); i < recessiveChildCount; i++ ) for ( int i = 0, recessiveChildCount = recessive.getChildCount(); i < recessiveChildCount; i++ )
private void printChildren(PrintWriter pw, Xpp3Dom configuration) { if (configuration.getChildCount() > 0) { int count = configuration.getChildCount(); for (int j = 0; j < count; j++) { Xpp3Dom c = configuration.getChild(j); if (c.getChildCount() == 0) { pw.print(keyString); } else { flipBrackets = !flipBrackets; indent = oldIndent; if (c.getChildCount() == 0) { pw.print(rbraceket()); } else {
private List<Object> toList(Xpp3Dom node, String childName) { List<Object> list = new ArrayList<>(); int n = node.getChildCount(); for (int i = 0; i < n; i++) { Xpp3Dom child = node.getChild(i); if (!childName.equals(child.getName())) { throw new YAMLException(format("child name: '%s' does not match expected name: '%s' at node %s", child.getName(), childName, node)); } Object childValue = child.getValue(); if (childValue == null) { childValue = toMap(child); } list.add(childValue); } return list; } }
for ( int i = dom.getChildCount() - 1; i >= 0; i-- )
private Map<String, Object> toMap(Xpp3Dom node) { Map<String, Object> map = new LinkedHashMap<>(); int n = node.getChildCount(); for (int i = 0; i < n; i++) { Xpp3Dom child = node.getChild(i); boolean isList = singularName != null; if (isList) { // check for eventual list construction for (int j = 0, grandChildCount = child.getChildCount(); j < grandChildCount; j++) { String grandChildName = child.getChild(j).getName(); isList &= grandChildName.equals(singularName);
void visit( Node node ) { for( String name: node.base.getAttributeNames() ) { new Leaf( "@" + name, node.base.getAttribute( name ) .replaceAll( "'", "\\\\'" ) ).accept( this ); } for ( Xpp3Dom child : node.base.getChildren() ) { if ( child.getChildCount() == 0 && child.getAttributeNames().length == 0 ) { new Leaf( child.getName(), child.getValue() ).accept( this ); } else if ( ( child.getChildCount() > 1 && child.getChild(0).getName().equals( child.getChild( 1 ).getName() ) ) || ( child.getChildCount() == 1 && child.getName().equals( child.getChild( 0 ).getName() + "s" ) ) ) { new ListNode( child ).accept( this ); } else { new Node( child ).accept( this ); } } } }
void printConfiguration( String indent, Object config ) { if (config != null ){ Xpp3Dom configuration = (Xpp3Dom) config; if (configuration.getChildCount() != 0) { append(","); println(); ConfigVisitor visitor = new ConfigVisitor(); visitor.visit( new Node( configuration ) ); printHashConfig( indent, visitor.config.map ); } append( " )"); } }
public XmlPlexusConfiguration( Xpp3Dom dom ) { super( dom.getName(), dom.getValue() ); // attrs String[] attributes = dom.getAttributeNames(); for (String attribute : attributes) { setAttribute(attribute, dom.getAttribute(attribute)); } // children int childCount = dom.getChildCount(); for ( int i = 0; i < childCount; i++ ) { addChild( new XmlPlexusConfiguration( dom.getChild( i ) ) ); } }
/** * @return whether the maven plugin has got configuration */ public boolean hasConfiguration() { return configuration.getChildCount() > 0; }
public int getChildCount() { if ( this.root == null ) { return 0; } return this.root.getChildCount(); }
public int getChildCount() { if ( this.root == null ) { return 0; } return this.root.getChildCount(); }
public int getChildCount() { return dom.getChildCount(); }
void accept( ConfigVisitor visitor ) { if ( base.getChild( 0 ).getChildCount() == 0 ) { Config list = new Config(); for( Xpp3Dom child : base.getChildren() ) { list.add( child ); } visitor.config.put( base.getName(), list ); } else { Config list = new Config(); for( Xpp3Dom child : base.getChildren() ) { ConfigVisitor nextVisitor = new ConfigVisitor(); nextVisitor.visit( new Node( child ) ); list.add( nextVisitor.config.map ); } visitor.config.put( base.getName(), list ); } } }
public PlexusConfiguration[] getChildren() { if ( this.root == null ) { return null; } PlexusConfiguration[] childrens = new PlexusConfiguration[this.root.getChildCount()]; for ( int i = 0; i < this.root.getChildCount(); i++ ) { childrens[i] = new Xpp3DomPlexusConfiguration( this.root.getChild( i ) ); } return childrens; }
private String getProjectFrameworkVersion( Xpp3Dom config ) { if ( config != null && config.getChildCount() > 0 ) { final Xpp3Dom subelement = config.getChild( "frameworkVersion" ); if ( subelement != null ) { return subelement.getValue(); } } return null; }
public void removeArchives() { int i = 0; while (i < dom.getChildCount()) { Xpp3Dom child = dom.getChild(i); if ("archive".equals(child.getName())) { dom.removeChild(i); } else { i++; } } }
private static void remove(Xpp3Dom node) { Xpp3Dom parent = node.getParent(); for (int i = 0; i < parent.getChildCount(); i++) { Xpp3Dom child = parent.getChild(i); if (child.equals(node)) { parent.removeChild(i); break; } } }
void printConfiguration( String indent, Object config ) { if (config != null ){ Xpp3Dom configuration = (Xpp3Dom) config; if (configuration.getChildCount() != 0) { append(","); println(); ConfigVisitor visitor = new ConfigVisitor(); visitor.visit( new Node( configuration ) ); printHashConfig( indent, visitor.config.map ); } append( " )"); } }