polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [1/3] zest-java git commit: Cleaning up various small bits.
Date Sun, 17 Apr 2016 04:59:56 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop 025464372 -> 9ae5a7529


Cleaning up various small bits.


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/6a8c5657
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/6a8c5657
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/6a8c5657

Branch: refs/heads/develop
Commit: 6a8c5657df6abb21b988b5f6e74e7bceb389c046
Parents: 0254643
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Sun Apr 17 12:16:39 2016 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Sun Apr 17 12:16:39 2016 +0800

----------------------------------------------------------------------
 .../AbstractAssociationInstance.java            |  1 +
 .../runtime/association/AssociationModel.java   | 32 ++------------------
 .../composite/CompositeMethodsModel.java        |  3 --
 .../composite/ValueConstraintsInstance.java     | 17 +++++++++++
 .../zest/runtime/property/PropertyModel.java    | 10 +-----
 .../rdf/entity/EntityTypeSerializer.java        |  1 -
 6 files changed, 22 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/6a8c5657/core/runtime/src/main/java/org/apache/zest/runtime/association/AbstractAssociationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/AbstractAssociationInstance.java
b/core/runtime/src/main/java/org/apache/zest/runtime/association/AbstractAssociationInstance.java
index f9c2c1c..10b9a2b 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/AbstractAssociationInstance.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/association/AbstractAssociationInstance.java
@@ -21,6 +21,7 @@ package org.apache.zest.runtime.association;
 
 import java.lang.reflect.Type;
 import java.util.function.BiFunction;
+import jdk.Exported;
 import org.apache.zest.api.association.AbstractAssociation;
 import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.entity.Identity;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/6a8c5657/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationModel.java
b/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationModel.java
index 56ddde6..d8ca0c9 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationModel.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationModel.java
@@ -26,14 +26,11 @@ import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
-import java.util.List;
-import java.util.stream.Stream;
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.association.AssociationDescriptor;
 import org.apache.zest.api.association.GenericAssociationInfo;
 import org.apache.zest.api.common.MetaInfo;
 import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.constraint.ConstraintViolation;
 import org.apache.zest.api.constraint.ConstraintViolationException;
 import org.apache.zest.api.entity.Aggregated;
 import org.apache.zest.api.entity.Queryable;
@@ -147,29 +144,13 @@ public final class AssociationModel
     public void checkConstraints( Object value )
         throws ConstraintViolationException
     {
-        if( constraints != null )
-        {
-            List<ConstraintViolation> violations = constraints.checkConstraints( value
);
-            if( !violations.isEmpty() )
-            {
-                Stream<Class<?>> empty = Stream.empty();
-                throw new ConstraintViolationException( "", empty, (Member) accessor, violations
);
-            }
-        }
+        ValueConstraintsInstance.checkConstraints( value, constraints, accessor );
     }
 
     public void checkAssociationConstraints( Association<?> association )
         throws ConstraintViolationException
     {
-        if( associationConstraints != null )
-        {
-            List<ConstraintViolation> violations = associationConstraints.checkConstraints(
association );
-            if( !violations.isEmpty() )
-            {
-                Stream<Class<?>> empty = Stream.empty();
-                throw new ConstraintViolationException( "", empty, (Member) accessor, violations
);
-            }
-        }
+        ValueConstraintsInstance.checkConstraints( association, associationConstraints, accessor
);
     }
 
     @Override
@@ -223,15 +204,8 @@ public final class AssociationModel
         {
             return false;
         }
-
         AssociationModel that = (AssociationModel) o;
-
-        if( !accessor.equals( that.accessor ) )
-        {
-            return false;
-        }
-
-        return true;
+        return accessor.equals( that.accessor );
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/zest-java/blob/6a8c5657/core/runtime/src/main/java/org/apache/zest/runtime/composite/CompositeMethodsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/composite/CompositeMethodsModel.java
b/core/runtime/src/main/java/org/apache/zest/runtime/composite/CompositeMethodsModel.java
index 31ae069..4d7b795 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/composite/CompositeMethodsModel.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/composite/CompositeMethodsModel.java
@@ -38,11 +38,9 @@ public final class CompositeMethodsModel
     implements VisitableHierarchy<Object, Object>, Dependencies
 {
     private final LinkedHashMap<Method, CompositeMethodModel> methods;
-    // TODO: With the large block disappearing, this member has no use. Other implications
are also commented out for now.
     private final MixinsModel mixinsModel;
 
     public CompositeMethodsModel( MixinsModel mixinsModel )
-//    public CompositeMethodsModel()
     {
         methods = new LinkedHashMap<>();
         this.mixinsModel = mixinsModel;
@@ -52,7 +50,6 @@ public final class CompositeMethodsModel
     {
         Collection<CompositeMethodModel> compositeMethods = methods.values();
         return compositeMethods.stream().flatMap( Dependencies.DEPENDENCIES_FUNCTION );
-//        return Iterables.flattenIterables( map( , methods.values() ) );
     }
 
     // Context

http://git-wip-us.apache.org/repos/asf/zest-java/blob/6a8c5657/core/runtime/src/main/java/org/apache/zest/runtime/composite/ValueConstraintsInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/composite/ValueConstraintsInstance.java
b/core/runtime/src/main/java/org/apache/zest/runtime/composite/ValueConstraintsInstance.java
index 5da6628..fbcbe6a 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/composite/ValueConstraintsInstance.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/composite/ValueConstraintsInstance.java
@@ -21,11 +21,15 @@
 package org.apache.zest.runtime.composite;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.stream.Stream;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.constraint.ConstraintViolation;
+import org.apache.zest.api.constraint.ConstraintViolationException;
 
 /**
  * JAVADOC
@@ -112,6 +116,19 @@ public final class ValueConstraintsInstance
         return violations;
     }
 
+    public static void checkConstraints( Object value, ValueConstraintsInstance constraintsInstance,
AccessibleObject accessor )
+    {
+        if( constraintsInstance != null )
+        {
+            List<ConstraintViolation> violations = constraintsInstance.checkConstraints(
value );
+            if( !violations.isEmpty() )
+            {
+                Stream<Class<?>> empty = Stream.empty();
+                throw new ConstraintViolationException( "", empty, (Member) accessor, violations
);
+            }
+        }
+    }
+
     @SuppressWarnings( "AnnotationAsSuperInterface" )
     private static class OptionalDummy
         implements Optional

http://git-wip-us.apache.org/repos/asf/zest-java/blob/6a8c5657/core/runtime/src/main/java/org/apache/zest/runtime/property/PropertyModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/property/PropertyModel.java
b/core/runtime/src/main/java/org/apache/zest/runtime/property/PropertyModel.java
index 89ff202..981f09d 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/property/PropertyModel.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/property/PropertyModel.java
@@ -233,15 +233,7 @@ public class PropertyModel
     public void checkConstraints( Object value )
         throws ConstraintViolationException
     {
-        if( constraints != null )
-        {
-            List<ConstraintViolation> violations = constraints.checkConstraints( value
);
-            if( !violations.isEmpty() )
-            {
-                Stream<Class<?>> empty = Stream.empty();
-                throw new ConstraintViolationException( "", empty, (Member) accessor, violations
);
-            }
-        }
+        ValueConstraintsInstance.checkConstraints( value, constraints, accessor );
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/zest-java/blob/6a8c5657/libraries/rdf/src/main/java/org/apache/zest/library/rdf/entity/EntityTypeSerializer.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/main/java/org/apache/zest/library/rdf/entity/EntityTypeSerializer.java
b/libraries/rdf/src/main/java/org/apache/zest/library/rdf/entity/EntityTypeSerializer.java
index 61070f9..4c3078d 100644
--- a/libraries/rdf/src/main/java/org/apache/zest/library/rdf/entity/EntityTypeSerializer.java
+++ b/libraries/rdf/src/main/java/org/apache/zest/library/rdf/entity/EntityTypeSerializer.java
@@ -25,7 +25,6 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.property.PropertyDescriptor;
 import org.apache.zest.api.util.Classes;
 import org.apache.zest.library.rdf.Rdfs;
 import org.apache.zest.library.rdf.ZestEntityType;


Mime
View raw message