You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/01/20 22:08:45 UTC
svn commit: r370899 - in
/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator:
ClientInitializer.vm ControlBean.vm ControlBeanInfo.vm ControlMacros.vm
ImplInitializer.vm
Author: cschoett
Date: Fri Jan 20 13:08:39 2006
New Revision: 370899
URL: http://svn.apache.org/viewcvs?rev=370899&view=rev
Log:
Resolution for BEEHIVE-1014.
*) Reverted generated control file veloctiy templates back to using import statements.
*) Added eclipse annotation 'SuppressWarnings("all")' to each of the generated classes.
*) Added serialVersionUID value to each of the generated classes which are serializable.
DRTs: all beehive passed
The net effect will be that there will no longer be warnings displayed for these generated classes in eclipse.
Modified:
beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm
beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm
beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm
beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.vm
Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm?rev=370899&r1=370898&r2=370899&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ClientInitializer.vm Fri Jan 20 13:08:39 2006
@@ -61,6 +61,8 @@
implements ${eventSet.className}${adaptor.eventSetBinding},
EventAdaptor, java.io.Serializable
{
+ private static final long serialVersionUID = 1L;
+
$client.className _client;
public ${adaptor.className}($client.className client) { _client = client; }
@@ -166,6 +168,7 @@
import org.apache.beehive.controls.runtime.bean.EventAdaptor;
import org.apache.beehive.controls.runtime.bean.AdaptorPersistenceDelegate;
+@SuppressWarnings("all")
public class $init.shortName
extends org.apache.beehive.controls.runtime.bean.ClientInitializer
{
Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm?rev=370899&r1=370898&r2=370899&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm Fri Jan 20 13:08:39 2006
@@ -37,8 +37,7 @@
* @param id The control identifier (or null to autogenerate a unique value)
* @param props The initialization Properties for the new instance (or null for defaults)
*/
- public ${bean.shortName}(org.apache.beehive.controls.api.context.ControlBeanContext context,
- String id, org.apache.beehive.controls.api.properties.PropertyMap props)
+ public ${bean.shortName}(ControlBeanContext context, String id, PropertyMap props)
{
this(context, id, props, ${intf.className}.class);
}
@@ -55,8 +54,8 @@
/**
* This is the protected version that is used by any ControlBean subclass
*/
- protected ${bean.shortName}(org.apache.beehive.controls.api.context.ControlBeanContext context,
- String id, org.apache.beehive.controls.api.properties.PropertyMap props, Class controlClass)
+ protected ${bean.shortName}(ControlBeanContext context, String id, PropertyMap props,
+ Class controlClass)
{
super(context, id, props, controlClass);
@@ -79,12 +78,12 @@
* Returns an array of parameter names for the request method, or null if no parameter
* data is available.
*/
- protected String [] getParameterNames(java.lang.reflect.Method m)
+ protected String [] getParameterNames(Method m)
{
// Check the local map for operations on this bean type
- if (_methodParamMap.containsKey(m))
+ if (_methodParamMap.containsKey(m))
{
- return _methodParamMap.get(m);
+ return _methodParamMap.get(m);
}
// Delegate up if not found locally
@@ -106,16 +105,15 @@
#if (!$intf.isExtension())
$intf.formalClassName target = ($intf.formalClassName)ensureControl();
#else
- org.apache.beehive.controls.api.bean.Extensible target =
- (org.apache.beehive.controls.api.bean.Extensible)ensureControl();
+ Extensible target = (Extensible)ensureControl();
#end
#if ($returnType != "void")
$returnType retval = ${operation.defaultReturnValue};
#end
#if ($operation.interceptorServiceNames.size() > 0)
String pivotedInterceptor = null;
- #end
-
+ #end
+
try
{
#if ($operation.interceptorServiceNames.size() == 0)
@@ -123,14 +121,14 @@
#else
preInvoke(${operation.methodField}, argArray, ${operation.methodField}Interceptors);
#end
-
+
##
## There are two basic generation patterns:
## - standard invoke (declared on a ControlInterface)
## - extensible invoke (declared on a ControlExtension)
##
#if ($returnType != "void")
- retval =
+ retval =
#end
#if (!$intf.isExtension())
target.${operation.name}($operation.argList)
@@ -155,25 +153,25 @@
{
//
// All exceptions are caught here, so postInvoke processing has visibility into
- // the exception status. Errors, RuntimExceptions, or declared checked exceptions will
+ // the exception status. Errors, RuntimExceptions, or declared checked exceptions will
// be rethrown.
//
thrown = t;
-
+
if (t instanceof Error) throw (Error)t;
else if (t instanceof RuntimeException) throw (RuntimeException)t;
#foreach ($thrownException in $operation.throwsList)
else if (t instanceof $thrownException) throw ($thrownException)t;
#end
- throw new java.lang.reflect.UndeclaredThrowableException(t);
+ throw new UndeclaredThrowableException(t);
}
finally
{
#if ($returnType == "void")
Object rv = null;
#else
- Object rv = retval;
+ Object rv = retval;
#end
#if ($operation.interceptorServiceNames.size() == 0)
postInvoke(${operation.methodField}, argArray, rv, thrown);
@@ -195,8 +193,7 @@
* A PropertyKey that can be used to access the $property.name property of the
* $property.propertySet.shortName PropertySet
*/
- public static final org.apache.beehive.controls.api.properties.PropertyKey $property.keyName =
- new org.apache.beehive.controls.api.properties.PropertyKey(${property.propertySet.className}.class, "$property.name");
+ public static final PropertyKey $property.keyName = new PropertyKey(${property.propertySet.className}.class, "$property.name");
#if ($property.propertySet.hasSetters())
public synchronized void ${property.writeMethod}($property.type value)
@@ -234,10 +231,10 @@
##
#macro (declareBoundPropertySupport)
/**
- * Adds a new PropertyChangeListener for listening to changes on bound properties of this
+ * Adds a new PropertyChangeListener for listening to changes on bound properties of this
* control.
*/
- public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
+ public void addPropertyChangeListener(PropertyChangeListener pcl)
{
getPropertyChangeSupport().addPropertyChangeListener(pcl);
}
@@ -246,16 +243,16 @@
* Adds a new PropertyChangeListener for listening to changes to a specific bound
* property of this control.
*/
- public void addPropertyChangeListener(String propertyName, java.beans.PropertyChangeListener pcl)
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener pcl)
{
getPropertyChangeSupport().addPropertyChangeListener(propertyName, pcl);
}
/**
- * Removes a registered PropertyChangeListener listening to changes on bound properties of
+ * Removes a registered PropertyChangeListener listening to changes on bound properties of
* this control.
*/
- public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
+ public void removePropertyChangeListener(PropertyChangeListener pcl)
{
getPropertyChangeSupport().removePropertyChangeListener(pcl);
}
@@ -264,7 +261,7 @@
* Removes a registered PropertyChangeListener listening to changes on a specific bound
* property of this control.
*/
- public void removePropertyChangeListener(String propertyName, java.beans.PropertyChangeListener pcl)
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener pcl)
{
getPropertyChangeSupport().removePropertyChangeListener(propertyName, pcl);
}
@@ -274,10 +271,10 @@
##
#macro (declareConstrainedPropertySupport)
/**
- * Adds a new PropertyChangeListener for listening to changes on bound properties of this
+ * Adds a new PropertyChangeListener for listening to changes on bound properties of this
* control.
*/
- public void addVetoableChangeListener(java.beans.VetoableChangeListener vcl)
+ public void addVetoableChangeListener(VetoableChangeListener vcl)
{
getVetoableChangeSupport().addVetoableChangeListener(vcl);
}
@@ -286,16 +283,16 @@
* Adds a new PropertyChangeListener for listening to changes to a specific constrained
* property of this control.
*/
- public void addVetoableChangeListener(String propertyName, java.beans.VetoableChangeListener vcl)
+ public void addVetoableChangeListener(String propertyName, VetoableChangeListener vcl)
{
getVetoableChangeSupport().addVetoableChangeListener(propertyName, vcl);
}
/**
- * Removes a registered PropertyChangeListener listening to changes on constrained properties
+ * Removes a registered PropertyChangeListener listening to changes on constrained properties
* of this control.
*/
- public void removeVetoableChangeListener(java.beans.VetoableChangeListener vcl)
+ public void removeVetoableChangeListener(VetoableChangeListener vcl)
{
getVetoableChangeSupport().removeVetoableChangeListener(vcl);
}
@@ -304,7 +301,7 @@
* Removes a registered PropertyChangeListener listening to changes to a specific constrained
* property of this control.
*/
- public void removeVetoableChangeListener(String propertyName, java.beans.VetoableChangeListener vcl)
+ public void removeVetoableChangeListener(String propertyName, VetoableChangeListener vcl)
{
getVetoableChangeSupport().removeVetoableChangeListener(propertyName, vcl);
}
@@ -333,7 +330,7 @@
#if ($event.interceptorServiceNames.size() != 0)
Object [] argArray = new Object[] {$event.argList};
String pivotedInterceptor = null;
- try
+ try
{
preEvent($event.methodField, argArray, ${event.methodField}Interceptors);
#end
@@ -361,7 +358,7 @@
#if ($event.interceptorServiceNames.size() != 0)
Object [] argArray = new Object[] {$event.argList};
String pivotedInterceptor = null;
- try
+ try
{
preEvent($event.methodField, argArray, ${event.methodField}Interceptors);
#end
@@ -387,13 +384,13 @@
## This macro defines the implementation of a preEvent method
##
#macro (declarePreEvent $eventSet)
- private void preEvent(java.lang.reflect.Method method, Object[] argArray, String[] interceptors)
+ private void preEvent(Method method, Object[] argArray, String[] interceptors)
throws org.apache.beehive.controls.spi.svc.InterceptorPivotException
{
for ( String n : interceptors )
{
org.apache.beehive.controls.spi.svc.Interceptor i = ensureInterceptor( n );
- try
+ try
{
i.preEvent( ${bean.shortName}.this, ${eventSet.formalShortName}.class , method, argArray );
}
@@ -402,14 +399,14 @@
ipe.setInterceptorName(n);
throw ipe;
}
- }
+ }
}
#end
##
## This macro defines the implementation of a preEvent method
##
#macro (declarePostEvent $eventSet)
- private void postEvent(java.lang.reflect.Method method, Object[] argArray, String[] interceptors, String pivotedInterceptor)
+ private void postEvent(Method method, Object[] argArray, String[] interceptors, String pivotedInterceptor)
{
for (int cnt = interceptors.length - 1; cnt >= 0; cnt--)
{
@@ -420,7 +417,7 @@
org.apache.beehive.controls.spi.svc.Interceptor i = ensureInterceptor( n );
i.postEvent( ${bean.shortName}.this, ${eventSet.formalShortName}.class , method, argArray );
}
- }
+ }
}
#end
##
@@ -428,13 +425,15 @@
##
#macro (declareEventSetImpl $eventSet)
/**
- * This inner class implements a simple proxy to deliver $eventSet.shortName events
+ * This inner class implements a simple proxy to deliver $eventSet.shortName events
* back to a register listener.
*/
protected class $eventSet.notifierClass
extends $eventSet.notifierExtends
implements ${eventSet.formalShortName}, java.io.Serializable
{
+ private static final long serialVersionUID = 1L;
+
#set ( $interceptor = false )
#foreach ($event in $eventSet.events)
#declareEventImpl($event)
@@ -463,8 +462,8 @@
{
$eventSet.notifierClass notifier = ($eventSet.notifierClass)getEventNotifier(${eventSet.shortName}.class);
notifier.addListener(listener);
- }
-
+ }
+
/**
* Unregisters an existing listener for ${eventSet.shortName} events on the bean.
*/
@@ -475,7 +474,7 @@
}
/**
- * Returns the array of registered listeners for ${eventSet.shortName} events on the bean, or
+ * Returns the array of registered listeners for ${eventSet.shortName} events on the bean, or
* an empty array if no listener has been registered
*/
public synchronized $eventSet.formalShortName [] ${eventSet.getListenersMethod}()
@@ -483,7 +482,7 @@
$eventSet.notifierClass notifier = ($eventSet.notifierClass)getEventNotifier(${eventSet.shortName}.class);
$eventSet.formalShortName [] listeners = new ${eventSet.shortName}[notifier.getListenerCount()];
notifier.getListeners(listeners);
- return listeners;
+ return listeners;
}
#end
##
@@ -494,9 +493,9 @@
* The _annotCache maintains a lookup cache from AnnotatedElements to an associated
* PropertyMap. This enables these maps to be shared across multiple beans.
*/
- static private java.util.HashMap _annotCache = new java.util.HashMap();
+ static private HashMap _annotCache = new HashMap();
- protected java.util.Map getPropertyMapCache() { return _annotCache; }
+ protected Map getPropertyMapCache() { return _annotCache; }
#end
##
## This macro enforces the VersionRequired annotation semantics
@@ -511,10 +510,8 @@
controlIntf = ${intf.getMostDerivedInterface().className}.class;
#end
- org.apache.beehive.controls.api.versioning.Version versionPresent =
- (org.apache.beehive.controls.api.versioning.Version)controlIntf.getAnnotation(org.apache.beehive.controls.api.versioning.Version.class);
- org.apache.beehive.controls.api.versioning.VersionRequired versionRequired =
- (${bean.shortName}.class).getAnnotation(org.apache.beehive.controls.api.versioning.VersionRequired.class);
+ Version versionPresent = (Version)controlIntf.getAnnotation(Version.class);
+ VersionRequired versionRequired = (${bean.shortName}.class).getAnnotation(VersionRequired.class);
org.apache.beehive.controls.runtime.bean.ControlBean.enforceVersionRequired("${intf.className}", versionPresent, versionRequired);
#end
@@ -527,13 +524,13 @@
private static String[] ${operation.methodField}Interceptors = ${operation.interceptorDecl};
#end
#end
-
+
#foreach ($eventSet in $intf.eventSets)
#foreach ($event in $eventSet.events)
#if ($event.interceptorServiceNames.size() != 0)
private static String[] ${event.methodField}Interceptors = ${event.interceptorDecl};
#end
- #end
+ #end
#end
#end
@@ -551,7 +548,7 @@
#if ($event.interceptorServiceNames.size() != 0)
${event.methodField}Interceptors = org.apache.beehive.controls.runtime.bean.ControlBeanContext.prioritizeInterceptors(${event.methodField}Interceptors);
#end
- #end
+ #end
#end
#end
@@ -562,6 +559,20 @@
package $bean.package;
#end
+import java.beans.*;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.beehive.controls.api.bean.*;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.properties.PropertyKey;
+import org.apache.beehive.controls.api.properties.PropertyMap;
+import org.apache.beehive.controls.api.versioning.*;
+
+@SuppressWarnings("all")
public class ${bean.classDeclaration}
extends ${bean.superClass.className}${bean.superTypeBinding}
implements ${intf.formalClassName}
@@ -620,4 +631,6 @@
#end
#declarePropertyCache()
+
+ private static final long serialVersionUID = 1L;
}
Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm?rev=370899&r1=370898&r2=370899&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm Fri Jan 20 13:08:39 2006
@@ -61,6 +61,21 @@
package $bean.package;
#end
+import java.beans.BeanDescriptor;
+import java.beans.EventSetDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.MethodDescriptor;
+import java.beans.ParameterDescriptor;
+import java.beans.PropertyDescriptor;
+import java.beans.PropertyEditor;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.runtime.bean.BeanPersistenceDelegate;
+import org.apache.beehive.controls.runtime.packaging.ControlEventSetDescriptor;
+
+@SuppressWarnings("all")
public class ${bean.shortName}BeanInfo
#if ($intf.superClass)
extends ${bean.superClass.className}BeanInfo
@@ -94,24 +109,24 @@
}
// java.beans.BeanInfo.getBeanDescriptor
- public java.beans.BeanDescriptor getBeanDescriptor()
+ public BeanDescriptor getBeanDescriptor()
{
- java.beans.BeanDescriptor bd = new java.beans.BeanDescriptor(${bean.className}.class);
+ BeanDescriptor bd = new BeanDescriptor(${bean.className}.class);
#if ($intf.featureInfo)
#initFeatureDescriptor("bd" $intf.featureInfo $bean.shortName)
#else
bd.setName(#localizeString("$bean.shortName"));
bd.setDisplayName(#localizeString("$bean.shortName"));
#end
-
+
//
// The org.apache.beehive.controls.runtime.bean.BeanPersistenceDelegate class
// implements the XMLDecode delegation model for all Control JavaBean types. It
// provides optimized XML persistance based upon the Control runtime architecture.
- // The 'persistenceDelegate' attribute of a BeanDescriptor is used by XMLEncoder to
+ // The 'persistenceDelegate' attribute of a BeanDescriptor is used by XMLEncoder to
// locate a delegate for a particular JavaBean type.
//
- bd.setValue("persistenceDelegate", new org.apache.beehive.controls.runtime.bean.BeanPersistenceDelegate());
+ bd.setValue("persistenceDelegate", new BeanPersistenceDelegate());
return bd;
}
@@ -120,13 +135,13 @@
* Stores MethodDescriptor descriptors for this bean and its superclasses into
* an array, starting at the specified index
*/
- protected void initMethodDescriptors(java.beans.MethodDescriptor [] methodDescriptors, int index)
+ protected void initMethodDescriptors(MethodDescriptor [] methodDescriptors, int index)
throws java.beans.IntrospectionException
{
#if ($intf.operations.size() > 0)
String [] paramNames;
- java.beans.ParameterDescriptor [] paramDescriptors;
- java.beans.MethodDescriptor md;
+ ParameterDescriptor [] paramDescriptors;
+ MethodDescriptor md;
#end
#foreach ($operation in $intf.operations)
@@ -134,14 +149,14 @@
// Declare MethodDescriptor for ${operation.name}(${operation.argList})
//
paramNames = _methodParamMap.get($operation.methodField);
- paramDescriptors = new java.beans.ParameterDescriptor[paramNames.length];
+ paramDescriptors = new ParameterDescriptor[paramNames.length];
for (int j = 0; j < paramNames.length; j++)
{
- paramDescriptors[j] = new java.beans.ParameterDescriptor();
+ paramDescriptors[j] = new ParameterDescriptor();
paramDescriptors[j].setName(paramNames[j]);
paramDescriptors[j].setDisplayName(paramNames[j]);
}
- md = new java.beans.MethodDescriptor($operation.methodField, paramDescriptors);
+ md = new MethodDescriptor($operation.methodField, paramDescriptors);
#if ($operation.featureInfo)
#initFeatureDescriptor("md" $operation.featureInfo $operation.name)
#end
@@ -153,20 +168,20 @@
//
// Add method descriptors from parent BeanInfo
//
- super.initMethodDescriptors(methodDescriptors, index);
+ super.initMethodDescriptors(methodDescriptors, index);
#end
}
- public java.beans.MethodDescriptor [] getMethodDescriptors()
+ public MethodDescriptor [] getMethodDescriptors()
{
- java.beans.MethodDescriptor [] methodDescriptors = new java.beans.MethodDescriptor[$intf.operationCount];
+ MethodDescriptor [] methodDescriptors = new MethodDescriptor[$intf.operationCount];
try
{
initMethodDescriptors(methodDescriptors, 0);
}
catch (java.beans.IntrospectionException ie)
{
- throw new org.apache.beehive.controls.api.ControlException("Unable to create MethodDescriptor", ie);
+ throw new ControlException("Unable to create MethodDescriptor", ie);
}
return methodDescriptors;
}
@@ -175,13 +190,13 @@
* Stores PropertyDescriptor descriptors for this bean and its superclasses into
* an array, starting at the specified index
*/
- protected void initPropertyDescriptors(java.beans.PropertyDescriptor [] propDescriptors, int index)
+ protected void initPropertyDescriptors(PropertyDescriptor [] propDescriptors, int index)
throws java.beans.IntrospectionException
{
- java.beans.PropertyDescriptor pd;
+ PropertyDescriptor pd;
#foreach ($propertySet in $intf.propertySets)
- #foreach ($property in $propertySet.properties)
+ #foreach ($property in $propertySet.properties)
#if ($property.getType().equals("boolean"))
#set ( $getterName = "is${property.accessorName}" )
#else
@@ -189,11 +204,9 @@
#end
#if ($propertySet.hasSetters())
#set ( $setterName = "set${property.accessorName}" )
- pd = new java.beans.PropertyDescriptor(#localizeString("$property.name"),
- ${bean.className}.class, "$getterName", "$setterName");
+ pd = new PropertyDescriptor(#localizeString("$property.name"), ${bean.className}.class, "$getterName", "$setterName");
#else
- pd = new java.beans.PropertyDescriptor(#localizeString("$property.name"),
- ${bean.className}.class, "$getterName", null );
+ pd = new PropertyDescriptor(#localizeString("$property.name"), ${bean.className}.class, "$getterName", null );
#end
#if ($property.propertyInfo)
pd.setBound($property.propertyInfo.bound());
@@ -213,21 +226,21 @@
//
// Add property descriptors from parent BeanInfo
//
- super.initPropertyDescriptors(propDescriptors, index);
+ super.initPropertyDescriptors(propDescriptors, index);
#end
}
// java.beans.BeanInfo.getPropertyDescriptors
- public java.beans.PropertyDescriptor [] getPropertyDescriptors()
+ public PropertyDescriptor [] getPropertyDescriptors()
{
- java.beans.PropertyDescriptor [] propDescriptors = new java.beans.PropertyDescriptor[$intf.propertyCount];
+ PropertyDescriptor [] propDescriptors = new PropertyDescriptor[$intf.propertyCount];
try
{
initPropertyDescriptors(propDescriptors, 0);
}
catch (java.beans.IntrospectionException ie)
{
- throw new org.apache.beehive.controls.api.ControlException("Unable to create PropertyDescriptor", ie);
+ throw new ControlException("Unable to create PropertyDescriptor", ie);
}
return propDescriptors;
}
@@ -237,11 +250,11 @@
// Adds the EventDescriptors for $eventSet.shortName to the EventDescriptor array, starting
// at index
//
- protected void ${eventSet.infoInitializer}(java.beans.MethodDescriptor [] eventDescriptors, int index)
+ protected void ${eventSet.infoInitializer}(MethodDescriptor [] eventDescriptors, int index)
{
String [] paramNames;
- java.beans.ParameterDescriptor [] paramDescriptors;
- java.beans.MethodDescriptor md;
+ ParameterDescriptor [] paramDescriptors;
+ MethodDescriptor md;
//
// Build a method descriptor for each event method in the event set
@@ -252,14 +265,14 @@
// Declare MethodDescriptor for ${event.name}(${event.argList})
//
paramNames = _methodParamMap.get($event.methodField);
- paramDescriptors = new java.beans.ParameterDescriptor[paramNames.length];
+ paramDescriptors = new ParameterDescriptor[paramNames.length];
for (int k = 0; k < paramNames.length; k++)
{
- paramDescriptors[k] = new java.beans.ParameterDescriptor();
+ paramDescriptors[k] = new ParameterDescriptor();
paramDescriptors[k].setName(paramNames[k]);
paramDescriptors[k].setDisplayName(paramNames[k]);
}
- md = new java.beans.MethodDescriptor($event.methodField, paramDescriptors);
+ md = new MethodDescriptor($event.methodField, paramDescriptors);
#if ($event.featureInfo)
#initFeatureDescriptor("md" $event.featureInfo $event.name)
#end
@@ -276,14 +289,13 @@
#end
- protected void initEventSetDescriptors(java.beans.EventSetDescriptor [] eventSetDescriptors, int index)
+ protected void initEventSetDescriptors(EventSetDescriptor [] eventSetDescriptors, int index)
throws java.beans.IntrospectionException
{
#if ($intf.eventSets.size() > 0)
- int eventIndex = 0;
- java.beans.MethodDescriptor [] eventDescriptors;
- java.beans.EventSetDescriptor esd;
- java.lang.reflect.Method addListener, removeListener, getListeners;
+ MethodDescriptor [] eventDescriptors;
+ EventSetDescriptor esd;
+ Method addListener, removeListener, getListeners;
Class eventIntf;
#end
@@ -295,13 +307,13 @@
//
try
{
- addListener =
+ addListener =
${bean.className}.class.getDeclaredMethod("$eventSet.addListenerMethod",
new Class [] { eventIntf });
- removeListener =
+ removeListener =
${bean.className}.class.getDeclaredMethod("$eventSet.removeListenerMethod",
new Class [] { eventIntf });
- getListeners =
+ getListeners =
${bean.className}.class.getDeclaredMethod("$eventSet.getListenersMethod",
new Class [] {});
}
@@ -310,27 +322,27 @@
// This is moderately lame, but there is no checked exception declared for this
// method. This could only happen as a result of a mismatch between bean class
// and introspector codegen.
- throw new org.apache.beehive.controls.api.ControlException("Unable to locate listener method", nsme);
+ throw new ControlException("Unable to locate listener method", nsme);
}
//
// Build the MethodDescriptor array contain all event set events
//
- eventDescriptors = new java.beans.MethodDescriptor[$eventSet.eventCount];
+ eventDescriptors = new MethodDescriptor[$eventSet.eventCount];
${eventSet.infoInitializer}(eventDescriptors, 0);
try
{
- esd = new org.apache.beehive.controls.runtime.packaging.ControlEventSetDescriptor(localizeString("$eventSet.descriptorName"),
+ esd = new ControlEventSetDescriptor(localizeString("$eventSet.descriptorName"),
eventIntf, eventDescriptors, addListener, removeListener, getListeners);
#if ($eventSet.featureInfo)
#initFeatureDescriptor("esd" $eventSet.featureInfo $eventSet.descriptorName)
#end
esd.setUnicast($eventSet.unicast);
}
- catch (java.beans.IntrospectionException ie)
+ catch (IntrospectionException ie)
{
- throw new org.apache.beehive.controls.api.ControlException("Unable to create EventDescriptor", ie);
+ throw new ControlException("Unable to create EventDescriptor", ie);
}
eventSetDescriptors[index++] = esd;
@@ -340,21 +352,21 @@
//
// Add event set descriptors from parent BeanInfo
//
- super.initEventSetDescriptors(eventSetDescriptors, index);
+ super.initEventSetDescriptors(eventSetDescriptors, index);
#end
}
// java.beans.BeanInfo.getEventSetDescriptors
- public java.beans.EventSetDescriptor [] getEventSetDescriptors()
+ public EventSetDescriptor [] getEventSetDescriptors()
{
- java.beans.EventSetDescriptor [] eventSetDescriptors = new java.beans.EventSetDescriptor[$intf.eventSetCount];
+ EventSetDescriptor [] eventSetDescriptors = new EventSetDescriptor[$intf.eventSetCount];
try
{
initEventSetDescriptors(eventSetDescriptors, 0);
}
catch (java.beans.IntrospectionException ie)
{
- throw new org.apache.beehive.controls.api.ControlException("Unable to create EventSetDescriptor", ie);
+ throw new ControlException("Unable to create EventSetDescriptor", ie);
}
return eventSetDescriptors;
}
Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm?rev=370899&r1=370898&r2=370899&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm Fri Jan 20 13:08:39 2006
@@ -37,11 +37,11 @@
##
#macro (declareMethodStatics)
#foreach ($operation in $intf.operations)
- static final java.lang.reflect.Method $operation.methodField;
+ static final Method $operation.methodField;
#end
#foreach ($eventSet in $intf.eventSets)
#foreach ($event in $eventSet.events)
- static final java.lang.reflect.Method $event.methodField;
+ static final Method $event.methodField;
#end
#end
@@ -54,7 +54,7 @@
// This map should be read-only after its initialization in the static block, hence
// using a plain HashMap is thread-safe.
//
- static java.util.HashMap<java.lang.reflect.Method, String []> _methodParamMap = new java.util.HashMap<java.lang.reflect.Method, String []>();
+ static HashMap<Method, String []> _methodParamMap = new HashMap<Method, String []>();
#end
##
## This macros provides the template for initializing the static final Method fields that
Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.vm
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.vm?rev=370899&r1=370898&r2=370899&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.vm (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ImplInitializer.vm Fri Jan 20 13:08:39 2006
@@ -31,7 +31,7 @@
##
#macro (declareReflectFields)
#foreach ($field in $init.reflectFields)
- static final java.lang.reflect.Field $field.reflectField;
+ static final Field $field.reflectField;
#end
#end
##
@@ -58,6 +58,8 @@
#set ($eventSet = $adaptor.eventSet)
protected static class $adaptor.className implements $eventSet.className, java.io.Serializable
{
+ private static final long serialVersionUID = 1L;
+
$impl.className _impl;
${adaptor.className}($impl.className impl) { _impl = impl; }
@@ -104,12 +106,12 @@
$context.type $context.localName = ($context.type)beanContext.getService(${context.type}.class, null);
#end
if ($context.localName == null)
- throw new org.apache.beehive.controls.api.ControlException("Contextual service $context.type is not available");
+ throw new ControlException("Contextual service $context.type is not available");
#initEventAdaptors($context)
#if ($init.needsReflection($context))
${context.reflectField}.set(impl, $context.localName);
#else
- impl.$context.name = $context.localName;
+ impl.$context.name = $context.localName;
#end
#end
##
@@ -130,7 +132,7 @@
#if ($init.needsReflection($proxy))
${proxy.reflectField}.set(impl, $proxy.localName);
#else
- impl.$proxy.name = $proxy.localName;
+ impl.$proxy.name = $proxy.localName;
#end
#end
##
@@ -140,13 +142,13 @@
/**
* Initializes the nested contextual services required by the implementation
*/
- public void initServices(org.apache.beehive.controls.runtime.bean.ControlBean bean, Object target)
+ public void initServices(ControlBean bean, Object target)
{
$impl.className impl = ($impl.className)target;
super.initServices(bean, impl);
- org.apache.beehive.controls.api.context.ControlBeanContext beanContext = bean.getControlBeanContext();
+ ControlBeanContext beanContext = bean.getControlBeanContext();
try
{
#foreach ($context in $impl.contexts)
@@ -156,14 +158,14 @@
catch (RuntimeException re) { throw re; }
catch (Exception e)
{
- throw new org.apache.beehive.controls.api.ControlException("Contextual service initialization failure", e);
+ throw new ControlException("Contextual service initialization failure", e);
}
}
/**
* Resets all nested contextual services instances to null
*/
- public void resetServices(org.apache.beehive.controls.runtime.bean.ControlBean bean, Object target)
+ public void resetServices(ControlBean bean, Object target)
{
$impl.className impl = ($impl.className)target;
@@ -178,7 +180,7 @@
catch (RuntimeException re) { throw re; }
catch (Exception e)
{
- throw new org.apache.beehive.controls.api.ControlException("Contextual service reset failure", e);
+ throw new ControlException("Contextual service reset failure", e);
}
}
#end
@@ -189,7 +191,7 @@
/**
* Initializes the nested client event proxies required by the implementation
*/
- public void initControls(org.apache.beehive.controls.runtime.bean.ControlBean bean, Object target)
+ public void initControls(ControlBean bean, Object target)
{
$impl.className impl = ($impl.className)target;
// DO NOT DELEGATE TO SUPERCLASS HERE. THE CONTROL CLIENT INIT HIERARCHY
@@ -202,7 +204,7 @@
catch (RuntimeException re) { throw re; }
catch (Exception e)
{
- throw new org.apache.beehive.controls.api.ControlException("Client event proxy initialization failure", e);
+ throw new ControlException("Client event proxy initialization failure", e);
}
}
#end
@@ -213,7 +215,7 @@
/**
* Initializes the nested client event proxies required by the implementation
*/
- public void initEventProxies(org.apache.beehive.controls.runtime.bean.ControlBean bean, Object target)
+ public void initEventProxies(ControlBean bean, Object target)
{
$impl.className impl = ($impl.className)target;
@@ -228,7 +230,7 @@
catch (RuntimeException re) { throw re; }
catch (Exception e)
{
- throw new org.apache.beehive.controls.api.ControlException("Client event proxy initialization failure", e);
+ throw new ControlException("Client event proxy initialization failure", e);
}
}
#end
@@ -239,6 +241,12 @@
package $init.package;
#end
+import java.lang.reflect.Field;
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.runtime.bean.ControlBean;
+
+@SuppressWarnings("all")
public class $init.shortName
#if ($init.hasSuperClass())
extends $init.superClass.className