cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [01/11] cayenne git commit: CAY-2176 Java 7 diamond class generation templates
Date Sun, 18 Dec 2016 18:21:02 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 832401b32 -> a24473ad8


http://git-wip-us.apache.org/repos/asf/cayenne/blob/bb981ae1/cayenne-tools/src/main/resources/templates/v1_2/singleclass.vm
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/resources/templates/v1_2/singleclass.vm b/cayenne-tools/src/main/resources/templates/v1_2/singleclass.vm
index e6dabce..2d83cfd 100644
--- a/cayenne-tools/src/main/resources/templates/v1_2/singleclass.vm
+++ b/cayenne-tools/src/main/resources/templates/v1_2/singleclass.vm
@@ -72,19 +72,19 @@ public#if("true" == "${object.isAbstract()}") abstract#end class ${subClassName}
 
 ## Create Properties
 #foreach( $attr in ${object.DeclaredAttributes} )
-    public static final Property<$importUtils.formatJavaType(${attr.Type}, false)>
${stringUtils.capitalizedAsConstant($attr.Name)} = new Property<$importUtils.formatJavaType(${attr.Type},
false)>("${attr.Name}");
+    public static final Property<$importUtils.formatJavaType(${attr.Type}, false)>
${stringUtils.capitalizedAsConstant($attr.Name)} = new Property<>("${attr.Name}");
 #end
 #foreach( $rel in ${object.DeclaredRelationships} )
 #if( $rel.ToMany )
 #if ( ${rel.CollectionType} == "java.util.Map")
     #set( $type = "$importUtils.formatJavaType($rel.CollectionType)<$importUtils.formatJavaType($entityUtils.getMapKeyType($rel)),
$importUtils.formatJavaType($rel.TargetEntity.ClassName)>" )
-    public static final Property<$type> ${stringUtils.capitalizedAsConstant($rel.Name)}
= new Property<$type>("${rel.Name}");
+    public static final Property<$type> ${stringUtils.capitalizedAsConstant($rel.Name)}
= new Property<>("${rel.Name}");
 #else
     #set( $type = "$importUtils.formatJavaType($rel.CollectionType)<$importUtils.formatJavaType($rel.TargetEntity.ClassName)>"
)
-    public static final Property<$type> ${stringUtils.capitalizedAsConstant($rel.Name)}
= new Property<$type>("${rel.Name}");
+    public static final Property<$type> ${stringUtils.capitalizedAsConstant($rel.Name)}
= new Property<>("${rel.Name}");
 #end
 #else
-    public static final Property<$importUtils.formatJavaType(${rel.TargetEntity.ClassName})>
${stringUtils.capitalizedAsConstant($rel.Name)} = new Property<$importUtils.formatJavaType(${rel.TargetEntity.ClassName})>("${rel.Name}");
+    public static final Property<$importUtils.formatJavaType(${rel.TargetEntity.ClassName})>
${stringUtils.capitalizedAsConstant($rel.Name)} = new Property<>("${rel.Name}");
 #end
 #end
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/bb981ae1/cayenne-tools/src/main/resources/templates/v1_2/superclass.vm
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/resources/templates/v1_2/superclass.vm b/cayenne-tools/src/main/resources/templates/v1_2/superclass.vm
index 4cee2be..9934a96 100644
--- a/cayenne-tools/src/main/resources/templates/v1_2/superclass.vm
+++ b/cayenne-tools/src/main/resources/templates/v1_2/superclass.vm
@@ -77,19 +77,19 @@ public abstract class ${superClassName} extends ${baseClassName} {
 
 ## Create Properties
 #foreach( $attr in ${object.DeclaredAttributes} )
-    public static final Property<$importUtils.formatJavaType(${attr.Type}, false)>
${stringUtils.capitalizedAsConstant($attr.Name)} = new Property<$importUtils.formatJavaType(${attr.Type},
false)>("${attr.Name}");
+    public static final Property<$importUtils.formatJavaType(${attr.Type}, false)>
${stringUtils.capitalizedAsConstant($attr.Name)} = new Property<>("${attr.Name}");
 #end
 #foreach( $rel in ${object.DeclaredRelationships} )
 #if( $rel.ToMany )
 #if ( ${rel.CollectionType} == "java.util.Map")
     #set( $type = "$importUtils.formatJavaType($rel.CollectionType)<$importUtils.formatJavaType($entityUtils.getMapKeyType($rel)),
$importUtils.formatJavaType($rel.TargetEntity.ClassName)>" )
-    public static final Property<$type> ${stringUtils.capitalizedAsConstant($rel.Name)}
= new Property<$type>("${rel.Name}");
+    public static final Property<$type> ${stringUtils.capitalizedAsConstant($rel.Name)}
= new Property<>("${rel.Name}");
 #else
     #set( $type = "$importUtils.formatJavaType($rel.CollectionType)<$importUtils.formatJavaType($rel.TargetEntity.ClassName)>"
)
-    public static final Property<$type> ${stringUtils.capitalizedAsConstant($rel.Name)}
= new Property<$type>("${rel.Name}");
+    public static final Property<$type> ${stringUtils.capitalizedAsConstant($rel.Name)}
= new Property<>("${rel.Name}");
 #end
 #else
-    public static final Property<$importUtils.formatJavaType(${rel.TargetEntity.ClassName})>
${stringUtils.capitalizedAsConstant($rel.Name)} = new Property<$importUtils.formatJavaType(${rel.TargetEntity.ClassName})>("${rel.Name}");
+    public static final Property<$importUtils.formatJavaType(${rel.TargetEntity.ClassName})>
${stringUtils.capitalizedAsConstant($rel.Name)} = new Property<>("${rel.Name}");
 #end
 #end
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/bb981ae1/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/CayenneGeneratorMojoTest.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/CayenneGeneratorMojoTest.java
b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/CayenneGeneratorMojoTest.java
index 10e843b..bd8068f 100644
--- a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/CayenneGeneratorMojoTest.java
+++ b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/CayenneGeneratorMojoTest.java
@@ -70,7 +70,7 @@ public class CayenneGeneratorMojoTest extends AbstractMojoTestCase {
         assertFalse(excludedEntity.exists());
 
         String content = FileUtils.readFileToString(superTestEntity);
-        assertTrue(content.contains("public static final Property<List<TestRelEntity>>
ADDITIONAL_REL = new Property<List<TestRelEntity>>(\"additionalRel\");"));
+        assertTrue(content.contains("public static final Property<List<TestRelEntity>>
ADDITIONAL_REL = new Property<>(\"additionalRel\");"));
         assertTrue(content.contains("public void addToAdditionalRel(TestRelEntity obj)"));
         assertTrue(content.contains("public void removeFromAdditionalRel(TestRelEntity obj)"));
 


Mime
View raw message