commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1301232 - in /commons/sandbox/flatfile/trunk/src/main: antlr/EntityTreeParser.g java/org/apache/commons/flatfile/ImmutableEntity.java
Date Thu, 15 Mar 2012 22:03:25 GMT
Author: mbenson
Date: Thu Mar 15 22:03:25 2012
New Revision: 1301232

URL: http://svn.apache.org/viewvc?rev=1301232&view=rev
Log:
method rename + a TODO and a final variable

Modified:
    commons/sandbox/flatfile/trunk/src/main/antlr/EntityTreeParser.g
    commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/ImmutableEntity.java

Modified: commons/sandbox/flatfile/trunk/src/main/antlr/EntityTreeParser.g
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/antlr/EntityTreeParser.g?rev=1301232&r1=1301231&r2=1301232&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/antlr/EntityTreeParser.g (original)
+++ commons/sandbox/flatfile/trunk/src/main/antlr/EntityTreeParser.g Thu Mar 15 22:03:25 2012
@@ -206,7 +206,7 @@ protected map returns [NamedEntityCollec
 	;
 
 protected immutable[Entity e] returns [Entity result = null]
-	:	IMMUTABLE { result = ImmutableEntity.getInstance(e); }
+	:	IMMUTABLE { result = ImmutableEntity.of(e); }
 	;
 
 protected entityOptions[Entity e]

Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/ImmutableEntity.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/ImmutableEntity.java?rev=1301232&r1=1301231&r2=1301232&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/ImmutableEntity.java
(original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/ImmutableEntity.java
Thu Mar 15 22:03:25 2012
@@ -57,6 +57,7 @@ public class ImmutableEntity {
         /**
          * {@inheritDoc}
          */
+        // TODO could we simplify/future-proof proxy definition by breaking Entity into smaller
interfaces?
         public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
             String name = method.getName();
 
@@ -91,7 +92,7 @@ public class ImmutableEntity {
             }
             Object result = method.invoke(delegate, args);
             if (GET_CHILD.equals(name)) { // return immutable children
-                result = getInstance((Entity) result);
+                result = of((Entity) result);
             }
             // if delegate returns same result 2x, that indicates it's the true
             // buffer, which we protect by copying:
@@ -119,7 +120,7 @@ public class ImmutableEntity {
      * @param e Entity delegate
      * @return immutable Entity
      */
-    public static Entity getInstance(Entity e) {
+    public static Entity of(Entity e) {
         Entity result = PROXIES.get(e);
         if (result == null) {
             result = (Entity) Proxy.newProxyInstance(e.getClass().getClassLoader(),
@@ -134,9 +135,8 @@ public class ImmutableEntity {
      * @param o to inspect.
      * @return interface array
      */
-    @SuppressWarnings("unchecked")
     private static Class<?>[] getInterfaces(Object o) {
-        List<Class<?>> interfaces = ClassUtils.getAllInterfaces(o.getClass());
+        final List<Class<?>> interfaces = ClassUtils.getAllInterfaces(o.getClass());
         return interfaces.toArray(new Class[interfaces.size()]);
     }
 }



Mime
View raw message