labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r740947 - in /labs/magma/trunk: foundation-beans/src/main/java/org/apache/magma/beans/PropertyInfo.java foundation-database/src/main/java/org/apache/magma/database/AddDefaultJPAValidation.aj
Date Thu, 05 Feb 2009 00:14:46 GMT
Author: simoneg
Date: Thu Feb  5 00:14:46 2009
New Revision: 740947

URL: http://svn.apache.org/viewvc?rev=740947&view=rev
Log:
LABS-289 : added a check for property type being null for fake getters

Modified:
    labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/PropertyInfo.java
    labs/magma/trunk/foundation-database/src/main/java/org/apache/magma/database/AddDefaultJPAValidation.aj

Modified: labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/PropertyInfo.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/PropertyInfo.java?rev=740947&r1=740946&r2=740947&view=diff
==============================================================================
--- labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/PropertyInfo.java
(original)
+++ labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/PropertyInfo.java
Thu Feb  5 00:14:46 2009
@@ -61,13 +61,15 @@
 		this.beanClass = beanClass;
 		this.name = descriptor.getName();
 		this.type = descriptor.getPropertyType();
-		this.isCollection = Collection.class.isAssignableFrom(this.type);
-		if (this.isCollection && descriptor.getReadMethod() != null) {
-			GenericClass returnType = GenericClass.forReturnType(descriptor.getReadMethod());
-			// It must have an add method
-			List<MethodDef> methods = returnType.findMethods("add", new Class<?>[] {null});
-			// It must have a single parameter of the type of the collection
-			this.collectionClass = methods.get(0).getParameterTypes()[0].getBaseClass();
+		if (this.type != null) {
+			this.isCollection = Collection.class.isAssignableFrom(this.type);
+			if (this.isCollection && descriptor.getReadMethod() != null) {
+				GenericClass returnType = GenericClass.forReturnType(descriptor.getReadMethod());
+				// It must have an add method
+				List<MethodDef> methods = returnType.findMethods("add", new Class<?>[] {null});
+				// It must have a single parameter of the type of the collection
+				this.collectionClass = methods.get(0).getParameterTypes()[0].getBaseClass();
+			}
 		}
 		this.readable = descriptor.getReadMethod() != null;
 		this.writeable = descriptor.getWriteMethod() != null;

Modified: labs/magma/trunk/foundation-database/src/main/java/org/apache/magma/database/AddDefaultJPAValidation.aj
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-database/src/main/java/org/apache/magma/database/AddDefaultJPAValidation.aj?rev=740947&r1=740946&r2=740947&view=diff
==============================================================================
--- labs/magma/trunk/foundation-database/src/main/java/org/apache/magma/database/AddDefaultJPAValidation.aj
(original)
+++ labs/magma/trunk/foundation-database/src/main/java/org/apache/magma/database/AddDefaultJPAValidation.aj
Thu Feb  5 00:14:46 2009
@@ -33,6 +33,7 @@
 	after(PropertyInfo info, Class beanClass) : 
 		execution(* PropertyInfo.init(PropertyDescriptor, Class)) && this(info) &&
args(.., beanClass) {
 		
+		if (info.getType() == null) return;
 		if (!info.getType().equals(String.class)) return;
 		
 		CompoundValidator val = info.getValidator();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message