Author: nbelaevski
Date: 2008-03-14 16:24:23 -0400 (Fri, 14 Mar 2008)
New Revision: 6837
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/model/JavaPrimitive.java
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/builder/AbstractCompilationContext.java
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/std/ObjectTemplateElement.java
trunk/cdk/generator/src/main/resources/META-INF/templates/templatecompiler/object.vm
Log:
CDK:
- c:object value enhancements
- loader now handles primitive types
Modified: trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/model/JavaPrimitive.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/model/JavaPrimitive.java 2008-03-14
18:59:25 UTC (rev 6836)
+++
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/model/JavaPrimitive.java 2008-03-14
20:24:23 UTC (rev 6837)
@@ -72,4 +72,8 @@
return wrappers.get(primitive.getName());
}
+
+ public static final boolean isPrimitive(String typeName) {
+ return types.containsKey(typeName);
+ }
}
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/builder/AbstractCompilationContext.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/builder/AbstractCompilationContext.java 2008-03-14
18:59:25 UTC (rev 6836)
+++
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/builder/AbstractCompilationContext.java 2008-03-14
20:24:23 UTC (rev 6837)
@@ -35,6 +35,7 @@
import org.ajax4jsf.builder.config.ClassVisitor;
import org.ajax4jsf.builder.config.ClassWalkingLogic;
+import org.ajax4jsf.builder.model.JavaPrimitive;
import org.ajax4jsf.templatecompiler.elements.A4JRendererElementsFactory;
import org.ajax4jsf.templatecompiler.elements.ElementsFactory;
import org.ajax4jsf.templatecompiler.elements.TemplateElement;
@@ -345,7 +346,11 @@
public Class<?> loadClass(String className) throws ClassNotFoundException {
Class<?> clazz = null;
try {
- clazz = this.classLoader.loadClass(className);
+ if (JavaPrimitive.isPrimitive(className)) {
+ clazz = JavaPrimitive.forName(className);
+ } else {
+ clazz = this.classLoader.loadClass(className);
+ }
} catch (ClassNotFoundException e) {
System.err.println("ClassNotFoundException message: "
+ e.getMessage());
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/std/ObjectTemplateElement.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/std/ObjectTemplateElement.java 2008-03-14
18:59:25 UTC (rev 6836)
+++
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/std/ObjectTemplateElement.java 2008-03-14
20:24:23 UTC (rev 6837)
@@ -71,7 +71,13 @@
this.strThisVariable = sVariableName;
- this.strExpression = ELParser.compileEL(strTempExpression, componentBean);
+ if (strTempExpression != null && strTempExpression.length() != 0) {
+ this.strExpression = ELParser.compileEL(strTempExpression, componentBean);
+ } else {
+ if (String.class.getName().equals(this.strType)) {
+ this.strExpression = "\"\"";
+ }
+ }
if (this.strType != null) {
try {
Modified:
trunk/cdk/generator/src/main/resources/META-INF/templates/templatecompiler/object.vm
===================================================================
---
trunk/cdk/generator/src/main/resources/META-INF/templates/templatecompiler/object.vm 2008-03-14
18:59:25 UTC (rev 6836)
+++
trunk/cdk/generator/src/main/resources/META-INF/templates/templatecompiler/object.vm 2008-03-14
20:24:23 UTC (rev 6837)
@@ -1 +1 @@
-$type $variable = $expression;
\ No newline at end of file
+$type $variable #if($expression) = $expression #end;
\ No newline at end of file
Show replies by date