commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1573215 - in /commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree: InMemoryNodeModel.java NodeKeyResolver.java NodeModel.java
Date Sat, 01 Mar 2014 20:07:47 GMT
Author: oheger
Date: Sat Mar  1 20:07:46 2014
New Revision: 1573215

URL: http://svn.apache.org/r1573215
Log:
Added a type parameter to NodeKeyResolver.

The whole class needs to have a type parameter rather than the single methods.
Otherwise, we get into trouble when implementing this interface.

Modified:
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeKeyResolver.java
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java?rev=1573215&r1=1573214&r2=1573215&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
Sat Mar  1 20:07:46 2014
@@ -188,7 +188,7 @@ public class InMemoryNodeModel implement
     }
 
     public void addProperty(final String key, final Iterable<?> values,
-            final NodeKeyResolver resolver)
+            final NodeKeyResolver<ImmutableNode> resolver)
     {
         if (valuesNotEmpty(values))
         {
@@ -203,7 +203,7 @@ public class InMemoryNodeModel implement
 
     public void addNodes(final String key,
             final Collection<? extends ImmutableNode> nodes,
-            final NodeKeyResolver resolver)
+            final NodeKeyResolver<ImmutableNode> resolver)
     {
         if (nodes != null && !nodes.isEmpty())
         {
@@ -243,7 +243,7 @@ public class InMemoryNodeModel implement
     }
 
     public void setProperty(final String key, final Object value,
-            final NodeKeyResolver resolver)
+            final NodeKeyResolver<ImmutableNode> resolver)
     {
         updateModel(new TransactionInitializer()
         {
@@ -276,7 +276,8 @@ public class InMemoryNodeModel implement
      * after subtrees have been removed. If this is the case, such nodes are
      * removed, too.
      */
-    public void clearTree(final String key, final NodeKeyResolver resolver)
+    public void clearTree(final String key,
+            final NodeKeyResolver<ImmutableNode> resolver)
     {
         updateModel(new TransactionInitializer()
         {
@@ -314,7 +315,7 @@ public class InMemoryNodeModel implement
      * {@inheritDoc} If this operation leaves an affected node in an undefined
      * state, it is removed from the model.
      */
-    public void clearProperty(final String key, final NodeKeyResolver resolver)
+    public void clearProperty(final String key, final NodeKeyResolver<ImmutableNode>
resolver)
     {
         updateModel(new TransactionInitializer() {
             public boolean initTransaction(ModelTransaction tx) {
@@ -415,7 +416,7 @@ public class InMemoryNodeModel implement
      * @param resolver the {@code NodeKeyResolver}
      */
     private void initializeAddTransaction(ModelTransaction tx, String key,
-            Iterable<?> values, NodeKeyResolver resolver)
+            Iterable<?> values, NodeKeyResolver<ImmutableNode> resolver)
     {
         NodeAddData<ImmutableNode> addData =
                 resolver.resolveAddKey(tx.getCurrentData().getRoot(), key, this);

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeKeyResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeKeyResolver.java?rev=1573215&r1=1573214&r2=1573215&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeKeyResolver.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeKeyResolver.java
Sat Mar  1 20:07:46 2014
@@ -32,8 +32,9 @@ import java.util.List;
  *
  * @version $Id$
  * @since 2.0
+ * @param <T> the type of the nodes supported by this resolver
  */
-public interface NodeKeyResolver
+public interface NodeKeyResolver<T>
 {
     /**
      * Performs a query for the specified key on the given root node. This is a
@@ -43,11 +44,9 @@ public interface NodeKeyResolver
      * @param root the root node
      * @param key the key to be resolved
      * @param handler the {@code NodeHandler}
-     * @param <T> the type of the nodes involved in this operation
      * @return a list with query results
      */
-    <T> List<QueryResult<T>> resolveKey(T root, String key,
-            NodeHandler<T> handler);
+    List<QueryResult<T>> resolveKey(T root, String key, NodeHandler<T>
handler);
 
     /**
      * Resolves a key of an add operation. Result is a {@code NodeAddData}
@@ -57,10 +56,9 @@ public interface NodeKeyResolver
      * @param root the root node
      * @param key the key to be resolved
      * @param handler the {@code NodeHandler}
-     * @param <T> the type of the nodes involved in this operation
      * @return a {@code NodeAddData} object to be used for the add operation
      */
-    <T> NodeAddData<T> resolveAddKey(T root, String key, NodeHandler<T>
handler);
+    NodeAddData<T> resolveAddKey(T root, String key, NodeHandler<T> handler);
 
     /**
      * Resolves a key for an update operation. Result is a
@@ -73,10 +71,9 @@ public interface NodeKeyResolver
      * @param newValue the new value for the key to be updated; this can be a
      *        single value or a container for multiple values
      * @param handler the {@code NodeHandler}
-     * @param <T> the type of the nodes involved in this operation
      * @return a {@code NodeUpdateData} object to be used for this update
      *         operation
      */
-    <T> NodeUpdateData<T> resolveUpdateKey(T root, String key, Object newValue,
+    NodeUpdateData<T> resolveUpdateKey(T root, String key, Object newValue,
             NodeHandler<T> handler);
 }

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java?rev=1573215&r1=1573214&r2=1573215&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java
Sat Mar  1 20:07:46 2014
@@ -79,7 +79,7 @@ public interface NodeModel<T>
      * @param values the values to be added at the position defined by the key
      * @param resolver the {@code NodeKeyResolver}
      */
-    void addProperty(String key, Iterable<?> values, NodeKeyResolver resolver);
+    void addProperty(String key, Iterable<?> values, NodeKeyResolver<T> resolver);
 
     /**
      * Adds a collection of new nodes to this model. This operation corresponds
@@ -95,7 +95,7 @@ public interface NodeModel<T>
      *         course, it is not possible to add something to an attribute)
      */
     void addNodes(String key, Collection<? extends T> nodes,
-            NodeKeyResolver resolver);
+            NodeKeyResolver<T> resolver);
 
     /**
      * Changes the value of a property. This is a more complex operation as it
@@ -110,7 +110,7 @@ public interface NodeModel<T>
      *        {@code NodeKeyResolver})
      * @param resolver the {@code NodeKeyResolver}
      */
-    void setProperty(String key, Object value, NodeKeyResolver resolver);
+    void setProperty(String key, Object value, NodeKeyResolver<T> resolver);
 
     /**
      * Removes the sub trees defined by the given key from this model. All nodes
@@ -120,7 +120,7 @@ public interface NodeModel<T>
      * @param key the key selecting the properties to be removed
      * @param resolver the {@code NodeKeyResolver}
      */
-    void clearTree(String key, NodeKeyResolver resolver);
+    void clearTree(String key, NodeKeyResolver<T> resolver);
 
     /**
      * Clears the value of a property. This method is similar to
@@ -131,7 +131,7 @@ public interface NodeModel<T>
      * @param key the key selecting the properties to be cleared
      * @param resolver the {@code NodeKeyResolver}
      */
-    void clearProperty(String key, NodeKeyResolver resolver);
+    void clearProperty(String key, NodeKeyResolver<T> resolver);
 
     /**
      * Removes all data from this model.



Mime
View raw message