sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1677068 - /sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
Date Thu, 30 Apr 2015 20:47:51 GMT
Author: desruisseaux
Date: Thu Apr 30 20:47:51 2015
New Revision: 1677068

URL: http://svn.apache.org/r1677068
Log:
Feature: in the special case of LinkOperation, we can redirect to get/setPropertyValue in
a more direct way.

Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java?rev=1677068&r1=1677067&r2=1677068&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
[UTF-8] Thu Apr 30 20:47:51 2015
@@ -223,7 +223,11 @@ public abstract class AbstractFeature im
      * Executes the parameterless operation of the given name and returns the value of its
result.
      */
     final Object getOperationValue(final String name) {
-        final Property result = getOperationResult(name);
+        final Operation operation = (Operation) type.getProperty(name);
+        if (operation instanceof LinkOperation) {
+            return getPropertyValue(((LinkOperation) operation).propertyName);
+        }
+        final Property result = operation.apply(this, null);
         if (result instanceof Attribute<?>) {
             return getAttributeValue((Attribute<?>) result);
         } else if (result instanceof FeatureAssociation) {
@@ -237,11 +241,16 @@ public abstract class AbstractFeature im
      * Executes the parameterless operation of the given name and sets the value of its result.
      */
     final void setOperationValue(final String name, final Object value) {
-        final Property result = getOperationResult(name);
-        if (result != null) {
-            setPropertyValue(result, value);
+        final Operation operation = (Operation) type.getProperty(name);
+        if (operation instanceof LinkOperation) {
+            setPropertyValue(((LinkOperation) operation).propertyName, value);
         } else {
-            throw new IllegalStateException(Errors.format(Errors.Keys.CanNotSetPropertyValue_1,
name));
+            final Property result = operation.apply(this, null);
+            if (result != null) {
+                setPropertyValue(result, value);
+            } else {
+                throw new IllegalStateException(Errors.format(Errors.Keys.CanNotSetPropertyValue_1,
name));
+            }
         }
     }
 



Mime
View raw message