@Test public void testGetChildren() { Configuration[] fontsConfig = configuration.getChildren("fonts"); assertEquals("only direct children should match", 1, fontsConfig.length); assertEquals("fonts element should be direct child", "fop/fonts", fontsConfig[0].getLocation()); }
@Override public Configuration[] getChildren(String key) { ArrayList<Configuration> result = new ArrayList<>(1); NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); ++i) { Node n = nl.item(i); if (n.getNodeName().equals(key)) { result.add(new DefaultConfiguration((Element) n)); } } return result.toArray(new Configuration[0]); }
DefaultConfiguration implements Configuration { @Override public Configuration[] getChildren(String key) { ArrayList<Configuration> result = new ArrayList<>(1); NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); ++i) { Node n = nl.item(i); if (n.getNodeName().equals(key)) { result.add(new DefaultConfiguration((Element) n)); } } return result.toArray(new Configuration[0]); } }
DefaultConfiguration implements Configuration { @Override public Configuration[] getChildren(String key) { ArrayList<Configuration> result = new ArrayList<>(1); NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); ++i) { Node n = nl.item(i); if (n.getNodeName().equals(key)) { result.add(new DefaultConfiguration((Element) n)); } } return result.toArray(new Configuration[0]); } DefaultConfiguration(String key);   DefaultConfiguration(Element element); }
DefaultConfiguration implements Configuration { @Override public Configuration[] getChildren(String key) { ArrayList<Configuration> result = new ArrayList<>(1); NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); ++i) { Node n = nl.item(i); if (n.getNodeName().equals(key)) { result.add(new DefaultConfiguration((Element) n)); } } return result.toArray(new Configuration[0]); } DefaultConfiguration(String key);   DefaultConfiguration(Element element); static String toString(Document document); void addChild(DefaultConfiguration configuration); @Override Configuration getChild(String key); @Override Configuration getChild(String key, boolean required); @Override Configuration[] getChildren(String key); @Override String[] getAttributeNames(); @Override String getAttribute(String key); @Override String getAttribute(String key, String defaultValue); @Override boolean getAttributeAsBoolean(String key, boolean defaultValue); @Override float getAttributeAsFloat(String key); @Override float getAttributeAsFloat(String key, float defaultValue); @Override int getAttributeAsInteger(String key, int defaultValue); @Override String getValue(); @Override String getValue(String defaultValue); @Override boolean getValueAsBoolean(); @Override boolean getValueAsBoolean(boolean defaultValue); @Override int getValueAsInteger(); @Override int getValueAsInteger(int defaultValue); @Override float getValueAsFloat(); @Override float getValueAsFloat(float defaultValue); @Override String getLocation(); }
DefaultConfiguration implements Configuration { @Override public Configuration[] getChildren(String key) { ArrayList<Configuration> result = new ArrayList<>(1); NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); ++i) { Node n = nl.item(i); if (n.getNodeName().equals(key)) { result.add(new DefaultConfiguration((Element) n)); } } return result.toArray(new Configuration[0]); } DefaultConfiguration(String key);   DefaultConfiguration(Element element); static String toString(Document document); void addChild(DefaultConfiguration configuration); @Override Configuration getChild(String key); @Override Configuration getChild(String key, boolean required); @Override Configuration[] getChildren(String key); @Override String[] getAttributeNames(); @Override String getAttribute(String key); @Override String getAttribute(String key, String defaultValue); @Override boolean getAttributeAsBoolean(String key, boolean defaultValue); @Override float getAttributeAsFloat(String key); @Override float getAttributeAsFloat(String key, float defaultValue); @Override int getAttributeAsInteger(String key, int defaultValue); @Override String getValue(); @Override String getValue(String defaultValue); @Override boolean getValueAsBoolean(); @Override boolean getValueAsBoolean(boolean defaultValue); @Override int getValueAsInteger(); @Override int getValueAsInteger(int defaultValue); @Override float getValueAsFloat(); @Override float getValueAsFloat(float defaultValue); @Override String getLocation();  }