You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2018/09/27 22:24:26 UTC
svn commit: r1842194 [12/34] - in /commons/proper/configuration/trunk/src:
main/java/org/apache/commons/configuration2/
main/java/org/apache/commons/configuration2/beanutils/
main/java/org/apache/commons/configuration2/builder/
main/java/org/apache/com...
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/resolver/CatalogResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/resolver/CatalogResolver.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/resolver/CatalogResolver.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/resolver/CatalogResolver.java Thu Sep 27 22:24:23 2018
@@ -97,7 +97,7 @@ public class CatalogResolver implements
*
* @param catalogs The delimited list of catalog files.
*/
- public void setCatalogFiles(String catalogs)
+ public void setCatalogFiles(final String catalogs)
{
manager.setCatalogFiles(catalogs);
}
@@ -106,7 +106,7 @@ public class CatalogResolver implements
* Set the FileSystem.
* @param fileSystem The FileSystem.
*/
- public void setFileSystem(FileSystem fileSystem)
+ public void setFileSystem(final FileSystem fileSystem)
{
this.fs = fileSystem;
manager.setFileSystem(fileSystem);
@@ -116,7 +116,7 @@ public class CatalogResolver implements
* Set the base path.
* @param baseDir The base path String.
*/
- public void setBaseDir(String baseDir)
+ public void setBaseDir(final String baseDir)
{
manager.setBaseDir(baseDir);
}
@@ -125,7 +125,7 @@ public class CatalogResolver implements
* Set the {@code ConfigurationInterpolator}.
* @param ci the {@code ConfigurationInterpolator}
*/
- public void setInterpolator(ConfigurationInterpolator ci)
+ public void setInterpolator(final ConfigurationInterpolator ci)
{
manager.setInterpolator(ci);
}
@@ -134,7 +134,7 @@ public class CatalogResolver implements
* Enables debug logging of xml-commons Catalog processing.
* @param debug True if debugging should be enabled, false otherwise.
*/
- public void setDebug(boolean debug)
+ public void setDebug(final boolean debug)
{
if (debug)
{
@@ -172,15 +172,15 @@ public class CatalogResolver implements
* @throws SAXException if an error occurs.
*/
@Override
- public InputSource resolveEntity(String publicId, String systemId)
+ public InputSource resolveEntity(final String publicId, final String systemId)
throws SAXException
{
String resolved = getResolver().getResolvedEntity(publicId, systemId);
if (resolved != null)
{
- String badFilePrefix = "file://";
- String correctFilePrefix = "file:///";
+ final String badFilePrefix = "file://";
+ final String correctFilePrefix = "file:///";
// Java 5 has a bug when constructing file URLS
if (resolved.startsWith(badFilePrefix) && !resolved.startsWith(correctFilePrefix))
@@ -190,19 +190,19 @@ public class CatalogResolver implements
try
{
- URL url = locate(fs, null, resolved);
+ final URL url = locate(fs, null, resolved);
if (url == null)
{
throw new ConfigurationException("Could not locate "
+ resolved);
}
- InputStream is = fs.getInputStream(url);
- InputSource iSource = new InputSource(resolved);
+ final InputStream is = fs.getInputStream(url);
+ final InputSource iSource = new InputSource(resolved);
iSource.setPublicId(publicId);
iSource.setByteStream(is);
return iSource;
}
- catch (Exception e)
+ catch (final Exception e)
{
log.warn("Failed to create InputSource for " + resolved, e);
return null;
@@ -232,7 +232,7 @@ public class CatalogResolver implements
*
* @param log the new logger
*/
- public void setLogger(ConfigurationLogger log)
+ public void setLogger(final ConfigurationLogger log)
{
initLogger(log);
}
@@ -242,7 +242,7 @@ public class CatalogResolver implements
*
* @param log the new logger
*/
- private void initLogger(ConfigurationLogger log)
+ private void initLogger(final ConfigurationLogger log)
{
this.log = (log != null) ? log : ConfigurationLogger.newDummyLogger();
}
@@ -265,9 +265,9 @@ public class CatalogResolver implements
* @param name the file name
* @return the URL pointing to the file
*/
- private static URL locate(FileSystem fs, String basePath, String name)
+ private static URL locate(final FileSystem fs, final String basePath, final String name)
{
- FileLocator locator =
+ final FileLocator locator =
FileLocatorUtils.fileLocator().fileSystem(fs)
.basePath(basePath).fileName(name).create();
return FileLocatorUtils.locate(locator);
@@ -294,7 +294,7 @@ public class CatalogResolver implements
* Set the FileSystem
* @param fileSystem The FileSystem in use.
*/
- public void setFileSystem(FileSystem fileSystem)
+ public void setFileSystem(final FileSystem fileSystem)
{
this.fs = fileSystem;
}
@@ -312,7 +312,7 @@ public class CatalogResolver implements
* Set the base directory.
* @param baseDir The base directory.
*/
- public void setBaseDir(String baseDir)
+ public void setBaseDir(final String baseDir)
{
if (baseDir != null)
{
@@ -329,7 +329,7 @@ public class CatalogResolver implements
return this.baseDir;
}
- public void setInterpolator(ConfigurationInterpolator ci)
+ public void setInterpolator(final ConfigurationInterpolator ci)
{
interpolator = ci;
}
@@ -362,7 +362,7 @@ public class CatalogResolver implements
catalog.setupReaders();
catalog.loadSystemCatalogs();
}
- catch (Exception ex)
+ catch (final Exception ex)
{
ex.printStackTrace();
}
@@ -409,16 +409,17 @@ public class CatalogResolver implements
public void loadSystemCatalogs() throws IOException
{
fs = ((CatalogManager) catalogManager).getFileSystem();
- String base = ((CatalogManager) catalogManager).getBaseDir();
+ final String base = ((CatalogManager) catalogManager).getBaseDir();
// This is safe because the catalog manager returns a vector of strings.
@SuppressWarnings("unchecked")
+ final
Vector<String> catalogs = catalogManager.getCatalogFiles();
if (catalogs != null)
{
for (int count = 0; count < catalogs.size(); count++)
{
- String fileName = catalogs.elementAt(count);
+ final String fileName = catalogs.elementAt(count);
URL url = null;
InputStream is = null;
@@ -431,16 +432,16 @@ public class CatalogResolver implements
is = fs.getInputStream(url);
}
}
- catch (ConfigurationException ce)
+ catch (final ConfigurationException ce)
{
- String name = url.toString();
+ final String name = url.toString();
// Ignore the exception.
catalogManager.debug.message(DEBUG_ALL,
"Unable to get input stream for " + name + ". " + ce.getMessage());
}
if (is != null)
{
- String mimeType = fileNameMap.getContentTypeFor(fileName);
+ final String mimeType = fileNameMap.getContentTypeFor(fileName);
try
{
if (mimeType != null)
@@ -449,7 +450,7 @@ public class CatalogResolver implements
continue;
}
}
- catch (Exception ex)
+ catch (final Exception ex)
{
// Ignore the exception.
catalogManager.debug.message(DEBUG_ALL,
@@ -473,7 +474,7 @@ public class CatalogResolver implements
* @param fileName The catalog file. May be a full URI String.
* @throws IOException If an error occurs.
*/
- public void parseCatalog(String baseDir, String fileName) throws IOException
+ public void parseCatalog(final String baseDir, final String fileName) throws IOException
{
base = locate(fs, baseDir, fileName);
catalogCwd = base;
@@ -484,14 +485,14 @@ public class CatalogResolver implements
for (int count = 0; !parsed && count < readerArr.size(); count++)
{
- CatalogReader reader = (CatalogReader) readerArr.get(count);
+ final CatalogReader reader = (CatalogReader) readerArr.get(count);
InputStream inStream;
try
{
inStream = fs.getInputStream(base);
}
- catch (Exception ex)
+ catch (final Exception ex)
{
catalogManager.debug.message(DEBUG_NORMAL, "Unable to access " + base
+ ex.getMessage());
@@ -503,7 +504,7 @@ public class CatalogResolver implements
reader.readCatalog(this, inStream);
parsed = true;
}
- catch (CatalogException ce)
+ catch (final CatalogException ce)
{
catalogManager.debug.message(DEBUG_NORMAL, "Parse failed for " + fileName
+ ce.getMessage());
@@ -520,7 +521,7 @@ public class CatalogResolver implements
{
inStream.close();
}
- catch (IOException ioe)
+ catch (final IOException ioe)
{
// Ignore the exception.
inStream = null;
@@ -541,10 +542,10 @@ public class CatalogResolver implements
* @return The normalized URI reference.
*/
@Override
- protected String normalizeURI(String uriref)
+ protected String normalizeURI(final String uriref)
{
- ConfigurationInterpolator ci = ((CatalogManager) catalogManager).getInterpolator();
- String resolved = ci != null ? String.valueOf(ci.interpolate(uriref)) : uriref;
+ final ConfigurationInterpolator ci = ((CatalogManager) catalogManager).getInterpolator();
+ final String resolved = ci != null ? String.valueOf(ci.interpolate(uriref)) : uriref;
return super.normalizeURI(resolved);
}
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/resolver/DefaultEntityResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/resolver/DefaultEntityResolver.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/resolver/DefaultEntityResolver.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/resolver/DefaultEntityResolver.java Thu Sep 27 22:24:23 2018
@@ -63,7 +63,7 @@ public class DefaultEntityResolver imple
* @throws IllegalArgumentException if the public ID is undefined
*/
@Override
- public void registerEntityId(String publicId, URL entityURL)
+ public void registerEntityId(final String publicId, final URL entityURL)
{
if (publicId == null)
{
@@ -84,7 +84,7 @@ public class DefaultEntityResolver imple
* @throws org.xml.sax.SAXException if a parsing exception occurs
*/
@Override
- public InputSource resolveEntity(String publicId, String systemId)
+ public InputSource resolveEntity(final String publicId, final String systemId)
throws SAXException
{
// Has this system identifier been registered?
@@ -100,14 +100,14 @@ public class DefaultEntityResolver imple
// createInputSourceFromURL() method of Commons Digester.
try
{
- URLConnection connection = entityURL.openConnection();
+ final URLConnection connection = entityURL.openConnection();
connection.setUseCaches(false);
- InputStream stream = connection.getInputStream();
- InputSource source = new InputSource(stream);
+ final InputStream stream = connection.getInputStream();
+ final InputSource source = new InputSource(stream);
source.setSystemId(entityURL.toExternalForm());
return source;
}
- catch (IOException e)
+ catch (final IOException e)
{
throw new SAXException(e);
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/spring/ConfigurationPropertiesFactoryBean.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/spring/ConfigurationPropertiesFactoryBean.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/spring/ConfigurationPropertiesFactoryBean.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/spring/ConfigurationPropertiesFactoryBean.java Thu Sep 27 22:24:23 2018
@@ -63,7 +63,7 @@ public class ConfigurationPropertiesFact
{
}
- public ConfigurationPropertiesFactoryBean(Configuration configuration)
+ public ConfigurationPropertiesFactoryBean(final Configuration configuration)
{
Assert.notNull(configuration, "configuration");
this.compositeConfiguration = new CompositeConfiguration(configuration);
@@ -116,7 +116,7 @@ public class ConfigurationPropertiesFact
if (configurations != null)
{
- for (Configuration configuration : configurations)
+ for (final Configuration configuration : configurations)
{
compositeConfiguration.addConfiguration(configuration);
}
@@ -124,10 +124,10 @@ public class ConfigurationPropertiesFact
if (locations != null)
{
- for (Resource location : locations)
+ for (final Resource location : locations)
{
- URL url = location.getURL();
- Configuration props = new Configurations().properties(url);
+ final URL url = location.getURL();
+ final Configuration props = new Configurations().properties(url);
compositeConfiguration.addConfiguration(props);
}
}
@@ -143,7 +143,7 @@ public class ConfigurationPropertiesFact
*
* @param configurations commons configurations objects which will be used as properties.
*/
- public void setConfigurations(Configuration[] configurations)
+ public void setConfigurations(final Configuration[] configurations)
{
this.configurations = defensiveCopy(configurations);
}
@@ -160,7 +160,7 @@ public class ConfigurationPropertiesFact
*
* @param locations resources of configuration files
*/
- public void setLocations(Resource[] locations)
+ public void setLocations(final Resource[] locations)
{
this.locations = defensiveCopy(locations);
}
@@ -176,7 +176,7 @@ public class ConfigurationPropertiesFact
* @see org.apache.commons.configuration2.AbstractConfiguration#setThrowExceptionOnMissing(boolean)
* @param throwExceptionOnMissing The new value for the property
*/
- public void setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
+ public void setThrowExceptionOnMissing(final boolean throwExceptionOnMissing)
{
this.throwExceptionOnMissing = throwExceptionOnMissing;
}
@@ -194,7 +194,7 @@ public class ConfigurationPropertiesFact
* @param <T> the type of the array
* @return the defensive copy of the array
*/
- private static <T> T[] defensiveCopy(T[] src)
+ private static <T> T[] defensiveCopy(final T[] src)
{
return (src != null) ? src.clone() : null;
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/spring/ConfigurationPropertySource.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/spring/ConfigurationPropertySource.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/spring/ConfigurationPropertySource.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/spring/ConfigurationPropertySource.java Thu Sep 27 22:24:23 2018
@@ -30,12 +30,12 @@ import org.springframework.core.env.Enum
public class ConfigurationPropertySource extends EnumerablePropertySource<Configuration>
{
- public ConfigurationPropertySource(String name, Configuration source)
+ public ConfigurationPropertySource(final String name, final Configuration source)
{
super(name, source);
}
- protected ConfigurationPropertySource(String name)
+ protected ConfigurationPropertySource(final String name)
{
super(name);
}
@@ -53,7 +53,7 @@ public class ConfigurationPropertySource
}
@Override
- public Object getProperty(String name)
+ public Object getProperty(final String name)
{
return source.getProperty(name);
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/sync/ReadWriteSynchronizer.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/sync/ReadWriteSynchronizer.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/sync/ReadWriteSynchronizer.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/sync/ReadWriteSynchronizer.java Thu Sep 27 22:24:23 2018
@@ -52,7 +52,7 @@ public class ReadWriteSynchronizer imple
*
* @param l the lock object to be used (can be <b>null</b>)
*/
- public ReadWriteSynchronizer(ReadWriteLock l)
+ public ReadWriteSynchronizer(final ReadWriteLock l)
{
lock = (l != null) ? l : createDefaultLock();
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/AbstractImmutableNodeHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/AbstractImmutableNodeHandler.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/AbstractImmutableNodeHandler.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/AbstractImmutableNodeHandler.java Thu Sep 27 22:24:23 2018
@@ -40,26 +40,26 @@ abstract class AbstractImmutableNodeHand
NodeHandler<ImmutableNode>
{
@Override
- public String nodeName(ImmutableNode node)
+ public String nodeName(final ImmutableNode node)
{
return node.getNodeName();
}
@Override
- public Object getValue(ImmutableNode node)
+ public Object getValue(final ImmutableNode node)
{
return node.getValue();
}
@Override
- public List<ImmutableNode> getChildren(ImmutableNode node)
+ public List<ImmutableNode> getChildren(final ImmutableNode node)
{
return node.getChildren();
}
@Override
- public <C> int getMatchingChildrenCount(ImmutableNode node,
- NodeMatcher<C> matcher, C criterion)
+ public <C> int getMatchingChildrenCount(final ImmutableNode node,
+ final NodeMatcher<C> matcher, final C criterion)
{
return getMatchingChildren(node, matcher, criterion).size();
}
@@ -69,12 +69,12 @@ abstract class AbstractImmutableNodeHand
* child nodes accepted by the specified matcher.
*/
@Override
- public <C> List<ImmutableNode> getMatchingChildren(ImmutableNode node,
- NodeMatcher<C> matcher, C criterion)
+ public <C> List<ImmutableNode> getMatchingChildren(final ImmutableNode node,
+ final NodeMatcher<C> matcher, final C criterion)
{
- List<ImmutableNode> result =
+ final List<ImmutableNode> result =
new ArrayList<>(node.getChildren().size());
- for (ImmutableNode c : node.getChildren())
+ for (final ImmutableNode c : node.getChildren())
{
if (matcher.matches(c, this, criterion))
{
@@ -89,25 +89,25 @@ abstract class AbstractImmutableNodeHand
* child nodes that have the specified name.
*/
@Override
- public List<ImmutableNode> getChildren(ImmutableNode node, String name)
+ public List<ImmutableNode> getChildren(final ImmutableNode node, final String name)
{
return getMatchingChildren(node, NodeNameMatchers.EQUALS, name);
}
@Override
- public ImmutableNode getChild(ImmutableNode node, int index)
+ public ImmutableNode getChild(final ImmutableNode node, final int index)
{
return node.getChildren().get(index);
}
@Override
- public int indexOfChild(ImmutableNode parent, ImmutableNode child)
+ public int indexOfChild(final ImmutableNode parent, final ImmutableNode child)
{
return parent.getChildren().indexOf(child);
}
@Override
- public int getChildrenCount(ImmutableNode node, String name)
+ public int getChildrenCount(final ImmutableNode node, final String name)
{
if (name == null)
{
@@ -117,19 +117,19 @@ abstract class AbstractImmutableNodeHand
}
@Override
- public Set<String> getAttributes(ImmutableNode node)
+ public Set<String> getAttributes(final ImmutableNode node)
{
return node.getAttributes().keySet();
}
@Override
- public boolean hasAttributes(ImmutableNode node)
+ public boolean hasAttributes(final ImmutableNode node)
{
return !node.getAttributes().isEmpty();
}
@Override
- public Object getAttributeValue(ImmutableNode node, String name)
+ public Object getAttributeValue(final ImmutableNode node, final String name)
{
return node.getAttributes().get(name);
}
@@ -139,7 +139,7 @@ abstract class AbstractImmutableNodeHand
* has a value or has children or has attributes.
*/
@Override
- public boolean isDefined(ImmutableNode node)
+ public boolean isDefined(final ImmutableNode node)
{
return AbstractImmutableNodeHandler.checkIfNodeDefined(node);
}
@@ -151,7 +151,7 @@ abstract class AbstractImmutableNodeHand
* @param node the node in question
* @return <b>true</b> if the node is defined, <b>false</b> otherwise
*/
- static boolean checkIfNodeDefined(ImmutableNode node)
+ static boolean checkIfNodeDefined(final ImmutableNode node)
{
return node.getValue() != null || !node.getChildren().isEmpty()
|| !node.getAttributes().isEmpty();
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/ConfigurationNodeVisitorAdapter.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/ConfigurationNodeVisitorAdapter.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/ConfigurationNodeVisitorAdapter.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/ConfigurationNodeVisitorAdapter.java Thu Sep 27 22:24:23 2018
@@ -37,7 +37,7 @@ public class ConfigurationNodeVisitorAda
* {@inheritDoc} Empty dummy implementation of this interface method.
*/
@Override
- public void visitBeforeChildren(T node, NodeHandler<T> handler)
+ public void visitBeforeChildren(final T node, final NodeHandler<T> handler)
{
}
@@ -45,7 +45,7 @@ public class ConfigurationNodeVisitorAda
* {@inheritDoc} Empty dummy implementation of this interface method.
*/
@Override
- public void visitAfterChildren(T node, NodeHandler<T> handler)
+ public void visitAfterChildren(final T node, final NodeHandler<T> handler)
{
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java Thu Sep 27 22:24:23 2018
@@ -69,7 +69,7 @@ public class DefaultConfigurationKey
* @param engine the expression engine (must not be <b>null</b>)
* @throws IllegalArgumentException if the expression engine is <b>null</b>
*/
- public DefaultConfigurationKey(DefaultExpressionEngine engine)
+ public DefaultConfigurationKey(final DefaultExpressionEngine engine)
{
this(engine, null);
}
@@ -82,7 +82,7 @@ public class DefaultConfigurationKey
* @param key the key to be wrapped
* @throws IllegalArgumentException if the expression engine is <b>null</b>
*/
- public DefaultConfigurationKey(DefaultExpressionEngine engine, String key)
+ public DefaultConfigurationKey(final DefaultExpressionEngine engine, final String key)
{
if (engine == null)
{
@@ -120,7 +120,7 @@ public class DefaultConfigurationKey
* should be escaped
* @return a reference to this object
*/
- public DefaultConfigurationKey append(String property, boolean escape)
+ public DefaultConfigurationKey append(final String property, final boolean escape)
{
String key;
if (escape && property != null)
@@ -151,7 +151,7 @@ public class DefaultConfigurationKey
* @param property the name of the property to be added
* @return a reference to this object
*/
- public DefaultConfigurationKey append(String property)
+ public DefaultConfigurationKey append(final String property)
{
return append(property, false);
}
@@ -162,7 +162,7 @@ public class DefaultConfigurationKey
* @param index the index to be appended
* @return a reference to this object
*/
- public DefaultConfigurationKey appendIndex(int index)
+ public DefaultConfigurationKey appendIndex(final int index)
{
keyBuffer.append(getSymbols().getIndexStart());
keyBuffer.append(index);
@@ -176,7 +176,7 @@ public class DefaultConfigurationKey
* @param attr the name of the attribute to be appended
* @return a reference to this object
*/
- public DefaultConfigurationKey appendAttribute(String attr)
+ public DefaultConfigurationKey appendAttribute(final String attr)
{
keyBuffer.append(constructAttributeKey(attr));
return this;
@@ -200,7 +200,7 @@ public class DefaultConfigurationKey
*
* @param len the new length of the key
*/
- public void setLength(int len)
+ public void setLength(final int len)
{
keyBuffer.setLength(len);
}
@@ -211,16 +211,16 @@ public class DefaultConfigurationKey
* @param other the other key
* @return a key object with the common key part
*/
- public DefaultConfigurationKey commonKey(DefaultConfigurationKey other)
+ public DefaultConfigurationKey commonKey(final DefaultConfigurationKey other)
{
if (other == null)
{
throw new IllegalArgumentException("Other key must no be null!");
}
- DefaultConfigurationKey result = new DefaultConfigurationKey(getExpressionEngine());
- KeyIterator it1 = iterator();
- KeyIterator it2 = other.iterator();
+ final DefaultConfigurationKey result = new DefaultConfigurationKey(getExpressionEngine());
+ final KeyIterator it1 = iterator();
+ final KeyIterator it2 = other.iterator();
while (it1.hasNext() && it2.hasNext() && partsEqual(it1, it2))
{
@@ -251,14 +251,14 @@ public class DefaultConfigurationKey
* @param other the key for which the difference is to be calculated
* @return the difference key
*/
- public DefaultConfigurationKey differenceKey(DefaultConfigurationKey other)
+ public DefaultConfigurationKey differenceKey(final DefaultConfigurationKey other)
{
- DefaultConfigurationKey common = commonKey(other);
- DefaultConfigurationKey result = new DefaultConfigurationKey(getExpressionEngine());
+ final DefaultConfigurationKey common = commonKey(other);
+ final DefaultConfigurationKey result = new DefaultConfigurationKey(getExpressionEngine());
if (common.length() < other.length())
{
- String k = other.toString().substring(common.length());
+ final String k = other.toString().substring(common.length());
// skip trailing delimiters
int i = 0;
while (i < k.length()
@@ -287,7 +287,7 @@ public class DefaultConfigurationKey
* @return a flag if both objects are equal
*/
@Override
- public boolean equals(Object obj)
+ public boolean equals(final Object obj)
{
if (this == obj)
{
@@ -298,7 +298,7 @@ public class DefaultConfigurationKey
return false;
}
- DefaultConfigurationKey c = (DefaultConfigurationKey) obj;
+ final DefaultConfigurationKey c = (DefaultConfigurationKey) obj;
return keyBuffer.toString().equals(c.toString());
}
@@ -332,7 +332,7 @@ public class DefaultConfigurationKey
* @param key the key to be checked
* @return <b>true</b> if this is an attribute key, <b>false</b> otherwise
*/
- public boolean isAttributeKey(String key)
+ public boolean isAttributeKey(final String key)
{
if (key == null)
{
@@ -352,7 +352,7 @@ public class DefaultConfigurationKey
* @param key the key to be decorated
* @return the decorated attribute key
*/
- public String constructAttributeKey(String key)
+ public String constructAttributeKey(final String key)
{
if (key == null)
{
@@ -362,7 +362,7 @@ public class DefaultConfigurationKey
{
return key;
}
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
buf.append(getSymbols().getAttributeStart()).append(key);
if (getSymbols().getAttributeEnd() != null)
{
@@ -378,7 +378,7 @@ public class DefaultConfigurationKey
* @param key the attribute key
* @return the name of the corresponding attribute
*/
- public String attributeName(String key)
+ public String attributeName(final String key)
{
return isAttributeKey(key) ? removeAttributeMarkers(key) : key;
}
@@ -389,7 +389,7 @@ public class DefaultConfigurationKey
* @param key the key
* @return the key with removed leading property delimiters
*/
- public String trimLeft(String key)
+ public String trimLeft(final String key)
{
if (key == null)
{
@@ -410,7 +410,7 @@ public class DefaultConfigurationKey
* @param key the key
* @return the key with removed trailing property delimiters
*/
- public String trimRight(String key)
+ public String trimRight(final String key)
{
if (key == null)
{
@@ -433,7 +433,7 @@ public class DefaultConfigurationKey
* @param key the key
* @return the key with removed property delimiters
*/
- public String trim(String key)
+ public String trim(final String key)
{
return trimRight(trimLeft(key));
}
@@ -456,7 +456,7 @@ public class DefaultConfigurationKey
* @param key the key to check
* @return a flag if there is a trailing delimiter
*/
- private boolean hasTrailingDelimiter(String key)
+ private boolean hasTrailingDelimiter(final String key)
{
return key.endsWith(getSymbols().getPropertyDelimiter())
&& (getSymbols().getEscapedDelimiter() == null || !key
@@ -470,7 +470,7 @@ public class DefaultConfigurationKey
* @param key the key to check
* @return a flag if there is a leading delimiter
*/
- private boolean hasLeadingDelimiter(String key)
+ private boolean hasLeadingDelimiter(final String key)
{
return key.startsWith(getSymbols().getPropertyDelimiter())
&& (getSymbols().getEscapedDelimiter() == null || !key
@@ -483,7 +483,7 @@ public class DefaultConfigurationKey
* @param key the key
* @return the key with removed attribute markers
*/
- private String removeAttributeMarkers(String key)
+ private String removeAttributeMarkers(final String key)
{
return key
.substring(
@@ -500,7 +500,7 @@ public class DefaultConfigurationKey
* @param key the key to be unescaped
* @return the unescaped key
*/
- private String unescapeDelimiters(String key)
+ private String unescapeDelimiters(final String key)
{
return (getSymbols().getEscapedDelimiter() == null) ? key
: StringUtils.replace(key, getSymbols()
@@ -524,7 +524,7 @@ public class DefaultConfigurationKey
* @param key the key to be escaped
* @return the escaped key
*/
- private String escapeDelimiters(String key)
+ private String escapeDelimiters(final String key)
{
return (getSymbols().getEscapedDelimiter() == null || key
.indexOf(getSymbols().getPropertyDelimiter()) < 0) ? key
@@ -540,7 +540,7 @@ public class DefaultConfigurationKey
* @param it2 the iterator with the second part
* @return a flag if both parts are equal
*/
- private static boolean partsEqual(KeyIterator it1, KeyIterator it2)
+ private static boolean partsEqual(final KeyIterator it1, final KeyIterator it2)
{
return it1.nextKey().equals(it2.nextKey())
&& it1.getIndex() == it2.getIndex()
@@ -593,7 +593,7 @@ public class DefaultConfigurationKey
* @param decorated a flag if the decorated key is to be returned
* @return the next key part
*/
- public String nextKey(boolean decorated)
+ public String nextKey(final boolean decorated)
{
if (!hasNext())
{
@@ -602,7 +602,7 @@ public class DefaultConfigurationKey
hasIndex = false;
indexValue = -1;
- String key = findNextIndices();
+ final String key = findNextIndices();
current = key;
hasIndex = checkIndex(key);
@@ -665,7 +665,7 @@ public class DefaultConfigurationKey
* @param decorated a flag if the decorated key is to be returned
* @return the current key
*/
- public String currentKey(boolean decorated)
+ public String currentKey(final boolean decorated)
{
return (decorated && !isPropertyKey()) ? constructAttributeKey(current)
: current;
@@ -734,7 +734,7 @@ public class DefaultConfigurationKey
{
return super.clone();
}
- catch (CloneNotSupportedException cex)
+ catch (final CloneNotSupportedException cex)
{
// should not happen
return null;
@@ -801,7 +801,7 @@ public class DefaultConfigurationKey
* @param endPos the end position
* @return the position of the next delimiter or -1 if there is none
*/
- private int nextDelimiterPos(String key, int pos, int endPos)
+ private int nextDelimiterPos(final String key, final int pos, final int endPos)
{
int delimiterPos = pos;
boolean found = false;
@@ -814,7 +814,7 @@ public class DefaultConfigurationKey
{
return -1;
}
- int escapePos = escapedPosition(key, delimiterPos);
+ final int escapePos = escapedPosition(key, delimiterPos);
if (escapePos < 0)
{
found = true;
@@ -838,21 +838,21 @@ public class DefaultConfigurationKey
* @param pos the position where a delimiter was found
* @return information about escaped delimiters
*/
- private int escapedPosition(String key, int pos)
+ private int escapedPosition(final String key, final int pos)
{
if (getSymbols().getEscapedDelimiter() == null)
{
// nothing to escape
return -1;
}
- int escapeOffset = escapeOffset();
+ final int escapeOffset = escapeOffset();
if (escapeOffset < 0 || escapeOffset > pos)
{
// No escaping possible at this position
return -1;
}
- int escapePos = key.indexOf(getSymbols()
+ final int escapePos = key.indexOf(getSymbols()
.getEscapedDelimiter(), pos - escapeOffset);
if (escapePos <= pos && escapePos >= 0)
{
@@ -894,7 +894,7 @@ public class DefaultConfigurationKey
* @param key the key to be checked
* @return a flag if the key is an attribute
*/
- private boolean checkAttribute(String key)
+ private boolean checkAttribute(final String key)
{
if (isAttributeKey(key))
{
@@ -911,16 +911,16 @@ public class DefaultConfigurationKey
* @param key the key to be checked
* @return a flag if an index is defined
*/
- private boolean checkIndex(String key)
+ private boolean checkIndex(final String key)
{
boolean result = false;
try
{
- int idx = key.lastIndexOf(getSymbols().getIndexStart());
+ final int idx = key.lastIndexOf(getSymbols().getIndexStart());
if (idx > 0)
{
- int endidx = key.indexOf(getSymbols().getIndexEnd(),
+ final int endidx = key.indexOf(getSymbols().getIndexEnd(),
idx);
if (endidx > idx + 1)
@@ -931,7 +931,7 @@ public class DefaultConfigurationKey
}
}
}
- catch (NumberFormatException nfe)
+ catch (final NumberFormatException nfe)
{
result = false;
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngine.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngine.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngine.java Thu Sep 27 22:24:23 2018
@@ -136,7 +136,7 @@ public class DefaultExpressionEngine imp
* @param syms the object with the symbols (must not be <b>null</b>)
* @throws IllegalArgumentException if the symbols are <b>null</b>
*/
- public DefaultExpressionEngine(DefaultExpressionEngineSymbols syms)
+ public DefaultExpressionEngine(final DefaultExpressionEngineSymbols syms)
{
this(syms, null);
}
@@ -152,8 +152,8 @@ public class DefaultExpressionEngine imp
* then a default matcher is used
* @throws IllegalArgumentException if the symbols are <b>null</b>
*/
- public DefaultExpressionEngine(DefaultExpressionEngineSymbols syms,
- NodeMatcher<String> nodeNameMatcher)
+ public DefaultExpressionEngine(final DefaultExpressionEngineSymbols syms,
+ final NodeMatcher<String> nodeNameMatcher)
{
if (syms == null)
{
@@ -183,10 +183,10 @@ public class DefaultExpressionEngine imp
* comment.
*/
@Override
- public <T> List<QueryResult<T>> query(T root, String key,
- NodeHandler<T> handler)
+ public <T> List<QueryResult<T>> query(final T root, final String key,
+ final NodeHandler<T> handler)
{
- List<QueryResult<T>> results = new LinkedList<>();
+ final List<QueryResult<T>> results = new LinkedList<>();
findNodesForKey(new DefaultConfigurationKey(this, key).iterator(),
root, results, handler);
return results;
@@ -200,23 +200,23 @@ public class DefaultExpressionEngine imp
* returned.
*/
@Override
- public <T> String nodeKey(T node, String parentKey, NodeHandler<T> handler)
+ public <T> String nodeKey(final T node, final String parentKey, final NodeHandler<T> handler)
{
if (parentKey == null)
{
// this is the root node
return StringUtils.EMPTY;
}
- DefaultConfigurationKey key = new DefaultConfigurationKey(this,
+ final DefaultConfigurationKey key = new DefaultConfigurationKey(this,
parentKey);
key.append(handler.nodeName(node), true);
return key.toString();
}
@Override
- public String attributeKey(String parentKey, String attributeName)
+ public String attributeKey(final String parentKey, final String attributeName)
{
- DefaultConfigurationKey key =
+ final DefaultConfigurationKey key =
new DefaultConfigurationKey(this, parentKey);
key.appendAttribute(attributeName);
return key.toString();
@@ -230,12 +230,12 @@ public class DefaultExpressionEngine imp
* name of the current node with its index is returned.
*/
@Override
- public <T> String canonicalKey(T node, String parentKey,
- NodeHandler<T> handler)
+ public <T> String canonicalKey(final T node, final String parentKey,
+ final NodeHandler<T> handler)
{
- String nodeName = handler.nodeName(node);
- T parent = handler.getParent(node);
- DefaultConfigurationKey key =
+ final String nodeName = handler.nodeName(node);
+ final T parent = handler.getParent(node);
+ final DefaultConfigurationKey key =
new DefaultConfigurationKey(this, parentKey);
key.append(StringUtils.defaultString(nodeName));
@@ -329,9 +329,9 @@ public class DefaultExpressionEngine imp
* @return a data object with information needed for the add operation
*/
@Override
- public <T> NodeAddData<T> prepareAdd(T root, String key, NodeHandler<T> handler)
+ public <T> NodeAddData<T> prepareAdd(final T root, final String key, final NodeHandler<T> handler)
{
- DefaultConfigurationKey.KeyIterator it = new DefaultConfigurationKey(
+ final DefaultConfigurationKey.KeyIterator it = new DefaultConfigurationKey(
this, key).iterator();
if (!it.hasNext())
{
@@ -339,8 +339,8 @@ public class DefaultExpressionEngine imp
"Key for add operation must be defined!");
}
- T parent = findLastPathNode(it, root, handler);
- List<String> pathNodes = new LinkedList<>();
+ final T parent = findLastPathNode(it, root, handler);
+ final List<String> pathNodes = new LinkedList<>();
while (it.hasNext())
{
@@ -370,8 +370,8 @@ public class DefaultExpressionEngine imp
* @param handler the node handler
*/
protected <T> void findNodesForKey(
- DefaultConfigurationKey.KeyIterator keyPart, T node,
- Collection<QueryResult<T>> results, NodeHandler<T> handler)
+ final DefaultConfigurationKey.KeyIterator keyPart, final T node,
+ final Collection<QueryResult<T>> results, final NodeHandler<T> handler)
{
if (!keyPart.hasNext())
{
@@ -380,7 +380,7 @@ public class DefaultExpressionEngine imp
else
{
- String key = keyPart.nextKey(false);
+ final String key = keyPart.nextKey(false);
if (keyPart.isPropertyKey())
{
processSubNodes(keyPart, findChildNodesByName(handler, node, key),
@@ -407,10 +407,10 @@ public class DefaultExpressionEngine imp
* @param handler the node handler
* @return the last existing node on the given path
*/
- protected <T> T findLastPathNode(DefaultConfigurationKey.KeyIterator keyIt,
- T node, NodeHandler<T> handler)
+ protected <T> T findLastPathNode(final DefaultConfigurationKey.KeyIterator keyIt,
+ final T node, final NodeHandler<T> handler)
{
- String keyPart = keyIt.nextKey(false);
+ final String keyPart = keyIt.nextKey(false);
if (keyIt.hasNext())
{
@@ -421,7 +421,7 @@ public class DefaultExpressionEngine imp
"Invalid path for add operation: "
+ "Attribute key in the middle!");
}
- int idx =
+ final int idx =
keyIt.hasIndex() ? keyIt.getIndex() : handler
.getMatchingChildrenCount(node, nameMatcher,
keyPart) - 1;
@@ -449,8 +449,8 @@ public class DefaultExpressionEngine imp
* @param nodes the target collection
* @param handler the node handler
*/
- private <T> void processSubNodes(DefaultConfigurationKey.KeyIterator keyPart,
- List<T> subNodes, Collection<QueryResult<T>> nodes, NodeHandler<T> handler)
+ private <T> void processSubNodes(final DefaultConfigurationKey.KeyIterator keyPart,
+ final List<T> subNodes, final Collection<QueryResult<T>> nodes, final NodeHandler<T> handler)
{
if (keyPart.hasIndex())
{
@@ -462,7 +462,7 @@ public class DefaultExpressionEngine imp
}
else
{
- for (T node : subNodes)
+ for (final T node : subNodes)
{
findNodesForKey((DefaultConfigurationKey.KeyIterator) keyPart
.clone(), node, nodes, handler);
@@ -480,8 +480,8 @@ public class DefaultExpressionEngine imp
* @param <T> the type of the nodes to be dealt with
* @return the index of this node
*/
- private <T> int determineIndex(T node, T parent, String nodeName,
- NodeHandler<T> handler)
+ private <T> int determineIndex(final T node, final T parent, final String nodeName,
+ final NodeHandler<T> handler)
{
return findChildNodesByName(handler, parent, nodeName).indexOf(node);
}
@@ -497,8 +497,8 @@ public class DefaultExpressionEngine imp
* @param <T> the type of the nodes to be dealt with
* @return a list with all matching child nodes
*/
- private <T> List<T> findChildNodesByName(NodeHandler<T> handler, T parent,
- String nodeName)
+ private <T> List<T> findChildNodesByName(final NodeHandler<T> handler, final T parent,
+ final String nodeName)
{
return handler.getMatchingChildren(parent, nameMatcher, nodeName);
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngineSymbols.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngineSymbols.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngineSymbols.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngineSymbols.java Thu Sep 27 22:24:23 2018
@@ -90,7 +90,7 @@ public final class DefaultExpressionEngi
*
* @param b the builder for defining the properties of this instance
*/
- private DefaultExpressionEngineSymbols(Builder b)
+ private DefaultExpressionEngineSymbols(final Builder b)
{
propertyDelimiter = b.propertyDelimiter;
escapedDelimiter = b.escapedDelimiter;
@@ -183,7 +183,7 @@ public final class DefaultExpressionEngi
* @return a flag whether these objects are equal
*/
@Override
- public boolean equals(Object obj)
+ public boolean equals(final Object obj)
{
if (this == obj)
{
@@ -194,7 +194,7 @@ public final class DefaultExpressionEngi
return false;
}
- DefaultExpressionEngineSymbols c = (DefaultExpressionEngineSymbols) obj;
+ final DefaultExpressionEngineSymbols c = (DefaultExpressionEngineSymbols) obj;
return new EqualsBuilder()
.append(getPropertyDelimiter(), c.getPropertyDelimiter())
.append(getEscapedDelimiter(), c.getEscapedDelimiter())
@@ -279,7 +279,7 @@ public final class DefaultExpressionEngi
* @param c the {@code DefaultExpressionEngineSymbols} object serving as
* starting point for this builder
*/
- public Builder(DefaultExpressionEngineSymbols c)
+ public Builder(final DefaultExpressionEngineSymbols c)
{
propertyDelimiter = c.getPropertyDelimiter();
escapedDelimiter = c.getEscapedDelimiter();
@@ -295,7 +295,7 @@ public final class DefaultExpressionEngi
* @param d the property delimiter
* @return a reference to this object for method chaining
*/
- public Builder setPropertyDelimiter(String d)
+ public Builder setPropertyDelimiter(final String d)
{
propertyDelimiter = d;
return this;
@@ -311,7 +311,7 @@ public final class DefaultExpressionEngi
* @param ed the escaped property delimiter
* @return a reference to this object for method chaining
*/
- public Builder setEscapedDelimiter(String ed)
+ public Builder setEscapedDelimiter(final String ed)
{
escapedDelimiter = ed;
return this;
@@ -325,7 +325,7 @@ public final class DefaultExpressionEngi
* @param is the index start
* @return a reference to this object for method chaining
*/
- public Builder setIndexStart(String is)
+ public Builder setIndexStart(final String is)
{
indexStart = is;
return this;
@@ -337,7 +337,7 @@ public final class DefaultExpressionEngi
* @param ie the index end
* @return a reference to this object for method chaining
*/
- public Builder setIndexEnd(String ie)
+ public Builder setIndexEnd(final String ie)
{
indexEnd = ie;
return this;
@@ -351,7 +351,7 @@ public final class DefaultExpressionEngi
* @param as the attribute start marker
* @return a reference to this object for method chaining
*/
- public Builder setAttributeStart(String as)
+ public Builder setAttributeStart(final String as)
{
attributeStart = as;
return this;
@@ -364,7 +364,7 @@ public final class DefaultExpressionEngi
* @param ae the attribute end marker
* @return a reference to this object for method chaining
*/
- public Builder setAttributeEnd(String ae)
+ public Builder setAttributeEnd(final String ae)
{
attributeEnd = ae;
return this;
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/ImmutableNode.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/ImmutableNode.java?rev=1842194&r1=1842193&r2=1842194&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/ImmutableNode.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/tree/ImmutableNode.java Thu Sep 27 22:24:23 2018
@@ -62,7 +62,7 @@ public final class ImmutableNode
*
* @param b the {@code Builder}
*/
- private ImmutableNode(Builder b)
+ private ImmutableNode(final Builder b)
{
children = b.createChildren();
attributes = b.createAttributes();
@@ -143,7 +143,7 @@ public final class ImmutableNode
* @param name the name of the newly created node
* @return the new node with the changed name
*/
- public ImmutableNode setName(String name)
+ public ImmutableNode setName(final String name)
{
return new Builder(children, attributes).name(name).value(value)
.create();
@@ -156,7 +156,7 @@ public final class ImmutableNode
* @param newValue the value of the newly created node
* @return the new node with the changed value
*/
- public ImmutableNode setValue(Object newValue)
+ public ImmutableNode setValue(final Object newValue)
{
return new Builder(children, attributes).name(nodeName).value(newValue)
.create();
@@ -170,10 +170,10 @@ public final class ImmutableNode
* @return the new node with the child node added
* @throws IllegalArgumentException if the child node is <b>null</b>
*/
- public ImmutableNode addChild(ImmutableNode child)
+ public ImmutableNode addChild(final ImmutableNode child)
{
checkChildNode(child);
- Builder builder = new Builder(children.size() + 1, attributes);
+ final Builder builder = new Builder(children.size() + 1, attributes);
builder.addChildren(children).addChild(child);
return createWithBasicProperties(builder);
}
@@ -186,12 +186,12 @@ public final class ImmutableNode
* @param child the child node to be removed
* @return the new node with the child node removed
*/
- public ImmutableNode removeChild(ImmutableNode child)
+ public ImmutableNode removeChild(final ImmutableNode child)
{
// use same size of children in case the child does not exist
- Builder builder = new Builder(children.size(), attributes);
+ final Builder builder = new Builder(children.size(), attributes);
boolean foundChild = false;
- for (ImmutableNode c : children)
+ for (final ImmutableNode c : children)
{
if (c == child)
{
@@ -216,13 +216,13 @@ public final class ImmutableNode
* @return the new node with the child replaced
* @throws IllegalArgumentException if the new child node is <b>null</b>
*/
- public ImmutableNode replaceChild(ImmutableNode oldChild,
- ImmutableNode newChild)
+ public ImmutableNode replaceChild(final ImmutableNode oldChild,
+ final ImmutableNode newChild)
{
checkChildNode(newChild);
- Builder builder = new Builder(children.size(), attributes);
+ final Builder builder = new Builder(children.size(), attributes);
boolean foundChild = false;
- for (ImmutableNode c : children)
+ for (final ImmutableNode c : children)
{
if (c == oldChild)
{
@@ -249,9 +249,9 @@ public final class ImmutableNode
* <b>null</b>)
* @return the new node with replaced children
*/
- public ImmutableNode replaceChildren(Collection<ImmutableNode> newChildren)
+ public ImmutableNode replaceChildren(final Collection<ImmutableNode> newChildren)
{
- Builder builder = new Builder(null, attributes);
+ final Builder builder = new Builder(null, attributes);
builder.addChildren(newChildren);
return createWithBasicProperties(builder);
}
@@ -266,9 +266,9 @@ public final class ImmutableNode
* @param value the attribute value
* @return the new node with this attribute
*/
- public ImmutableNode setAttribute(String name, Object value)
+ public ImmutableNode setAttribute(final String name, final Object value)
{
- Map<String, Object> newAttrs = new HashMap<>(attributes);
+ final Map<String, Object> newAttrs = new HashMap<>(attributes);
newAttrs.put(name, value);
return createWithNewAttributes(newAttrs);
}
@@ -283,14 +283,14 @@ public final class ImmutableNode
* @param newAttributes the map with attributes to be added
* @return the new node with these attributes
*/
- public ImmutableNode setAttributes(Map<String, ?> newAttributes)
+ public ImmutableNode setAttributes(final Map<String, ?> newAttributes)
{
if (newAttributes == null || newAttributes.isEmpty())
{
return this;
}
- Map<String, Object> newAttrs = new HashMap<>(attributes);
+ final Map<String, Object> newAttrs = new HashMap<>(attributes);
newAttrs.putAll(newAttributes);
return createWithNewAttributes(newAttrs);
}
@@ -303,9 +303,9 @@ public final class ImmutableNode
* @param name the name of the attribute
* @return the new node without this attribute
*/
- public ImmutableNode removeAttribute(String name)
+ public ImmutableNode removeAttribute(final String name)
{
- Map<String, Object> newAttrs = new HashMap<>(attributes);
+ final Map<String, Object> newAttrs = new HashMap<>(attributes);
if (newAttrs.remove(name) != null)
{
return createWithNewAttributes(newAttrs);
@@ -321,7 +321,7 @@ public final class ImmutableNode
* @param builder the already prepared builder
* @return the newly created node
*/
- private ImmutableNode createWithBasicProperties(Builder builder)
+ private ImmutableNode createWithBasicProperties(final Builder builder)
{
return builder.name(nodeName).value(value).create();
}
@@ -333,7 +333,7 @@ public final class ImmutableNode
* @param newAttrs the new attributes
* @return the new node instance
*/
- private ImmutableNode createWithNewAttributes(Map<String, Object> newAttrs)
+ private ImmutableNode createWithNewAttributes(final Map<String, Object> newAttrs)
{
return createWithBasicProperties(new Builder(children, null)
.addAttributes(newAttrs));
@@ -347,7 +347,7 @@ public final class ImmutableNode
* @param child the child node to be checked
* @throws IllegalArgumentException if the child node is <b>null</b>
*/
- private static void checkChildNode(ImmutableNode child)
+ private static void checkChildNode(final ImmutableNode child)
{
if (child == null)
{
@@ -411,7 +411,7 @@ public final class ImmutableNode
*
* @param childCount the number of child nodes
*/
- public Builder(int childCount)
+ public Builder(final int childCount)
{
this();
initChildrenCollection(childCount);
@@ -429,8 +429,8 @@ public final class ImmutableNode
* @param dirChildren the children of the new node
* @param dirAttrs the attributes of the new node
*/
- private Builder(List<ImmutableNode> dirChildren,
- Map<String, Object> dirAttrs)
+ private Builder(final List<ImmutableNode> dirChildren,
+ final Map<String, Object> dirAttrs)
{
directChildren = dirChildren;
directAttributes = dirAttrs;
@@ -447,7 +447,7 @@ public final class ImmutableNode
* @param childCount the expected number of new children
* @param dirAttrs the attributes of the new node
*/
- private Builder(int childCount, Map<String, Object> dirAttrs)
+ private Builder(final int childCount, final Map<String, Object> dirAttrs)
{
this(null, dirAttrs);
initChildrenCollection(childCount);
@@ -459,7 +459,7 @@ public final class ImmutableNode
* @param n the node name
* @return a reference to this object for method chaining
*/
- public Builder name(String n)
+ public Builder name(final String n)
{
name = n;
return this;
@@ -471,7 +471,7 @@ public final class ImmutableNode
* @param v the value
* @return a reference to this object for method chaining
*/
- public Builder value(Object v)
+ public Builder value(final Object v)
{
value = v;
return this;
@@ -484,7 +484,7 @@ public final class ImmutableNode
* @param c the child node (must not be <b>null</b>)
* @return a reference to this object for method chaining
*/
- public Builder addChild(ImmutableNode c)
+ public Builder addChild(final ImmutableNode c)
{
if (c != null)
{
@@ -503,7 +503,7 @@ public final class ImmutableNode
* @param children a collection with the child nodes to be added
* @return a reference to this object for method chaining
*/
- public Builder addChildren(Collection<? extends ImmutableNode> children)
+ public Builder addChildren(final Collection<? extends ImmutableNode> children)
{
if (children != null)
{
@@ -522,7 +522,7 @@ public final class ImmutableNode
* @param value the attribute value
* @return a reference to this object for method chaining
*/
- public Builder addAttribute(String name, Object value)
+ public Builder addAttribute(final String name, final Object value)
{
ensureAttributesExist();
attributes.put(name, value);
@@ -537,7 +537,7 @@ public final class ImmutableNode
* @param attrs the map with attributes to be added (may be <b>null</b>
* @return a reference to this object for method chaining
*/
- public Builder addAttributes(Map<String, ?> attrs)
+ public Builder addAttributes(final Map<String, ?> attrs)
{
if (attrs != null)
{
@@ -555,7 +555,7 @@ public final class ImmutableNode
*/
public ImmutableNode create()
{
- ImmutableNode newNode = new ImmutableNode(this);
+ final ImmutableNode newNode = new ImmutableNode(this);
children = null;
attributes = null;
return newNode;
@@ -632,7 +632,7 @@ public final class ImmutableNode
*
* @param childCount the expected number of new children
*/
- private void initChildrenCollection(int childCount)
+ private void initChildrenCollection(final int childCount)
{
if (childCount > 0)
{
@@ -648,11 +648,11 @@ public final class ImmutableNode
* @return the collection with null entries removed
*/
private static Collection<? extends ImmutableNode> filterNull(
- Collection<? extends ImmutableNode> children)
+ final Collection<? extends ImmutableNode> children)
{
- List<ImmutableNode> result =
+ final List<ImmutableNode> result =
new ArrayList<>(children.size());
- for (ImmutableNode c : children)
+ for (final ImmutableNode c : children)
{
if (c != null)
{