Author: rich
Date: Fri Apr 22 01:49:00 2005
New Revision: 164202
URL: http://svn.apache.org/viewcvs?rev=164202&view=rev
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-544 : @Jpf.FormBean
annotation is not inherited
tests: bvt in netui
BB: self (linux)
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
Modified:
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java?rev=164202&r1=164201&r2=164202&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
Fri Apr 22 01:49:00 2005
@@ -38,6 +38,7 @@
import
org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
import org.apache.beehive.netui.compiler.typesystem.type.DeclaredType;
import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance;
+import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
@@ -288,30 +289,41 @@
}
}
- private void getMessageResourcesFromForm( TypeDeclaration formClassType,
ActionModel actionModel )
+ private void getMessageResourcesFromForm( TypeDeclaration formTypeDecl,
ActionModel actionModel )
{
- AnnotationInstance ann = CompilerUtils.getAnnotation( formClassType,
FORM_BEAN_TAG_NAME );
+ if ( ! ( formTypeDecl instanceof ClassDeclaration ) ) return;
- if ( ann != null )
+ ClassDeclaration formClassDecl = ( ClassDeclaration ) formTypeDecl;
+
+ while ( true )
{
- String defaultMessageResources = CompilerUtils.getString( ann,
MESSAGE_BUNDLE_ATTR, true );
+ AnnotationInstance ann = CompilerUtils.getAnnotation(
formClassDecl, FORM_BEAN_TAG_NAME );
- if ( defaultMessageResources != null )
+ if ( ann != null )
{
- for ( Iterator ii = getMessageResourcesList().iterator();
ii.hasNext(); )
+ String defaultMessageResources = CompilerUtils.getString( ann,
MESSAGE_BUNDLE_ATTR, true );
+
+ if ( defaultMessageResources != null )
{
- MessageResourcesModel i = ( MessageResourcesModel )
ii.next();
- if ( i.getParameter().equals( defaultMessageResources ) )
return;
+ for ( Iterator ii = getMessageResourcesList().iterator();
ii.hasNext(); )
+ {
+ MessageResourcesModel i = ( MessageResourcesModel )
ii.next();
+ if ( i.getParameter().equals( defaultMessageResources
) ) return;
+ }
+
+ MessageResourcesModel mrm = new MessageResourcesModel(
this );
+ String key = "formMessages:" +
CompilerUtils.getLoadableName( formClassDecl ); // TODO: constant
+ mrm.setKey( key );
+ mrm.setParameter( defaultMessageResources );
+ mrm.setReturnNull( true );
+ addMessageResources( mrm );
+ if ( actionModel != null )
actionModel.setFormBeanMessageResourcesKey( key );
}
-
- MessageResourcesModel mrm = new MessageResourcesModel( this );
- String key = "formMessages:" + CompilerUtils.getLoadableName(
formClassType ); // TODO: constant
- mrm.setKey( key );
- mrm.setParameter( defaultMessageResources );
- mrm.setReturnNull( true );
- addMessageResources( mrm );
- if ( actionModel != null )
actionModel.setFormBeanMessageResourcesKey( key );
}
+
+ ClassType superType = formClassDecl.getSuperclass();
+ if ( superType == null ) break;
+ formClassDecl = superType.getClassTypeDeclaration();
}
}