incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1556236 - in /sling/whiteboard/justin/yamf: org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/ org.apache.sling.yamf.impl/src/main/java/org/apache/sling/yamf/impl/ org.apache.sling.yamf.impl/src/test/java/org/apache...
Date Tue, 07 Jan 2014 14:59:46 GMT
Author: justin
Date: Tue Jan  7 14:59:46 2014
New Revision: 1556236

URL: http://svn.apache.org/r1556236
Log:
change @Projection to @Via

Added:
    sling/whiteboard/justin/yamf/org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/Via.java
      - copied, changed from r1556235, sling/whiteboard/justin/yamf/org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/Projection.java
    sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/impl/ViaTest.java
      - copied, changed from r1556235, sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/impl/ProjectionTest.java
    sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ViaModel.java
      - copied, changed from r1556235, sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ProjectionModel.java
Removed:
    sling/whiteboard/justin/yamf/org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/Projection.java
    sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/impl/ProjectionTest.java
    sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ProjectionModel.java
Modified:
    sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/main/java/org/apache/sling/yamf/impl/YamfAdapterFactory.java

Copied: sling/whiteboard/justin/yamf/org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/Via.java
(from r1556235, sling/whiteboard/justin/yamf/org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/Projection.java)
URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/Via.java?p2=sling/whiteboard/justin/yamf/org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/Via.java&p1=sling/whiteboard/justin/yamf/org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/Projection.java&r1=1556235&r2=1556236&rev=1556236&view=diff
==============================================================================
--- sling/whiteboard/justin/yamf/org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/Projection.java
(original)
+++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.api/src/main/java/org/apache/sling/yamf/annotations/Via.java
Tue Jan  7 14:59:46 2014
@@ -27,7 +27,7 @@ import java.lang.annotation.Target;
  */
 @Target({ ElementType.FIELD, ElementType.METHOD })
 @Retention(RetentionPolicy.RUNTIME)
-public @interface Projection {
+public @interface Via {
 
     public String value();
 

Modified: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/main/java/org/apache/sling/yamf/impl/YamfAdapterFactory.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/main/java/org/apache/sling/yamf/impl/YamfAdapterFactory.java?rev=1556236&r1=1556235&r2=1556236&view=diff
==============================================================================
--- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/main/java/org/apache/sling/yamf/impl/YamfAdapterFactory.java
(original)
+++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/main/java/org/apache/sling/yamf/impl/YamfAdapterFactory.java
Tue Jan  7 14:59:46 2014
@@ -50,7 +50,7 @@ import org.apache.sling.commons.osgi.Ser
 import org.apache.sling.yamf.annotations.Default;
 import org.apache.sling.yamf.annotations.Model;
 import org.apache.sling.yamf.annotations.Optional;
-import org.apache.sling.yamf.annotations.Projection;
+import org.apache.sling.yamf.annotations.Via;
 import org.apache.sling.yamf.annotations.Source;
 import org.apache.sling.yamf.spi.Injector;
 import org.osgi.framework.InvalidSyntaxException;
@@ -354,15 +354,15 @@ public class YamfAdapterFactory implemen
     }
 
     private Object getAdaptable(Object adaptable, AnnotatedElement point) {
-        Projection projection = point.getAnnotation(Projection.class);
-        if (projection == null) {
+        Via viaAnnotation = point.getAnnotation(Via.class);
+        if (viaAnnotation == null) {
             return adaptable;
         }
-        String projectionPath = projection.value();
+        String viaPropertyName = viaAnnotation.value();
         try {
-            return PropertyUtils.getProperty(adaptable, projectionPath);
+            return PropertyUtils.getProperty(adaptable, viaPropertyName);
         } catch (Exception e) {
-            log.error("Unable to execution projection " + projectionPath, e);
+            log.error("Unable to execution projection " + viaPropertyName, e);
             return null;
         }
     }

Copied: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/impl/ViaTest.java
(from r1556235, sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/impl/ProjectionTest.java)
URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/impl/ViaTest.java?p2=sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/impl/ViaTest.java&p1=sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/impl/ProjectionTest.java&r1=1556235&r2=1556236&rev=1556236&view=diff
==============================================================================
--- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/impl/ProjectionTest.java
(original)
+++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/impl/ViaTest.java
Tue Jan  7 14:59:46 2014
@@ -27,7 +27,7 @@ import org.apache.sling.api.resource.Res
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.api.wrappers.ValueMapDecorator;
 import org.apache.sling.yamf.impl.injectors.ValueMapInjector;
-import org.apache.sling.yamf.testmodels.classes.ProjectionModel;
+import org.apache.sling.yamf.testmodels.classes.ViaModel;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -36,7 +36,7 @@ import org.mockito.runners.MockitoJUnitR
 import org.osgi.framework.Constants;
 
 @RunWith(MockitoJUnitRunner.class)
-public class ProjectionTest {
+public class ViaTest {
 
     @Mock
     private Resource resource;
@@ -60,7 +60,7 @@ public class ProjectionTest {
         ValueMap map = new ValueMapDecorator(Collections.<String, Object> singletonMap("firstProperty",
value));
         when(resource.adaptTo(ValueMap.class)).thenReturn(map);
         
-        ProjectionModel model = factory.getAdapter(request, ProjectionModel.class);
+        ViaModel model = factory.getAdapter(request, ViaModel.class);
         assertNotNull(model);
         assertEquals(value, model.getFirstProperty());
     }

Copied: sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ViaModel.java
(from r1556235, sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ProjectionModel.java)
URL: http://svn.apache.org/viewvc/sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ViaModel.java?p2=sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ViaModel.java&p1=sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ProjectionModel.java&r1=1556235&r2=1556236&rev=1556236&view=diff
==============================================================================
--- sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ProjectionModel.java
(original)
+++ sling/whiteboard/justin/yamf/org.apache.sling.yamf.impl/src/test/java/org/apache/sling/yamf/testmodels/classes/ViaModel.java
Tue Jan  7 14:59:46 2014
@@ -20,15 +20,15 @@ import javax.inject.Inject;
 
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.yamf.annotations.Model;
-import org.apache.sling.yamf.annotations.Projection;
+import org.apache.sling.yamf.annotations.Via;
+
+@Model(adaptables = SlingHttpServletRequest.class)
+public class ViaModel {
 
-@Model(adaptables=SlingHttpServletRequest.class)
-public class ProjectionModel {
-    
     @Inject
-    @Projection("resource")
+    @Via("resource")
     private String firstProperty;
-    
+
     public String getFirstProperty() {
         return firstProperty;
     }



Mime
View raw message