cvs commit: spice/sandbox/metaclass/src/java/org/realityforge/metaclass/model MethodDescriptor.java FeatureDescriptor.java FieldDescriptor.java ClassDescriptor.java
Peter Donald <[email protected]>
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
donaldp 03/10/28 03:02:02
Modified: sandbox/metaclass/src/java/org/realityforge/metaclass/model
MethodDescriptor.java FeatureDescriptor.java
FieldDescriptor.java ClassDescriptor.java
Log:
Start to support differences between declared and actual attributes
Revision Changes Path
1.8 +2 -2 spice/sandbox/metaclass/src/java/org/realityforge/metaclass/model/MethodDescriptor.java
Index: MethodDescriptor.java
===================================================================
RCS file: /cvsroot/spice/spice/sandbox/metaclass/src/java/org/realityforge/metaclass/model/MethodDescriptor.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MethodDescriptor.java 22 Oct 2003 09:19:41 -0000 1.7
+++ MethodDescriptor.java 28 Oct 2003 11:02:01 -0000 1.8
@@ -24,7 +24,7 @@
* about method.</p>
*
* @author <a href="mailto:peter at realityforge.org">Peter Donald</a>
- * @version $Revision: 1.7 $ $Date: 2003/10/22 09:19:41 $
+ * @version $Revision: 1.8 $ $Date: 2003/10/28 11:02:01 $
*/
public final class MethodDescriptor
extends FeatureDescriptor
@@ -63,7 +63,7 @@
final ParameterDescriptor[] parameters,
final Attribute[] attributes )
{
- super( attributes );
+ super( attributes, attributes );
if( null == name )
{
throw new NullPointerException( "name" );
1.9 +51 -3 spice/sandbox/metaclass/src/java/org/realityforge/metaclass/model/FeatureDescriptor.java
Index: FeatureDescriptor.java
===================================================================
RCS file: /cvsroot/spice/spice/sandbox/metaclass/src/java/org/realityforge/metaclass/model/FeatureDescriptor.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FeatureDescriptor.java 22 Oct 2003 09:19:41 -0000 1.8
+++ FeatureDescriptor.java 28 Oct 2003 11:02:02 -0000 1.9
@@ -18,13 +18,18 @@
*
* @author <a href="mailto:peter at realityforge.org">Peter Donald</a>
* @author <a href="mailto:doug at stocksoftware.com.au">Doug Hagan</a>
- * @version $Revision: 1.8 $ $Date: 2003/10/22 09:19:41 $
+ * @version $Revision: 1.9 $ $Date: 2003/10/28 11:02:02 $
*/
public abstract class FeatureDescriptor
implements Serializable
{
/**
- * The arbitrary set of Attributes associated with feature.
+ * The arbitrary set of declared Attributes.
+ */
+ private final Attribute[] m_declaredAttributes;
+
+ /**
+ * The arbitrary set of Attributes.
*/
private final Attribute[] m_attributes;
@@ -33,12 +38,24 @@
*
* @param attributes the attributes
*/
- protected FeatureDescriptor( final Attribute[] attributes )
+ protected FeatureDescriptor( final Attribute[] declaredAttributes,
+ final Attribute[] attributes )
{
+ if( null == declaredAttributes )
+ {
+ throw new NullPointerException( "declaredAttributes" );
+ }
if( null == attributes )
{
throw new NullPointerException( "attributes" );
}
+ for( int i = 0; i < declaredAttributes.length; i++ )
+ {
+ if( null == declaredAttributes[ i ] )
+ {
+ throw new NullPointerException( "declaredAttributes[" + i + "]" );
+ }
+ }
for( int i = 0; i < attributes.length; i++ )
{
if( null == attributes[ i ] )
@@ -46,8 +63,39 @@
throw new NullPointerException( "attributes[" + i + "]" );
}
}
+ for( int i = 0; i < declaredAttributes.length; i++ )
+ {
+ final Attribute attribute = declaredAttributes[ i ];
+ boolean match = false;
+ for( int j = 0; j < attributes.length; j++ )
+ {
+ final Attribute other = attributes[ j ];
+ if( attribute.equals( other ) )
+ {
+ match = true;
+ break;
+ }
+ }
+ if( !match )
+ {
+ final String message =
+ "declared attribute not an attribute";
+ throw new IllegalArgumentException( message );
+ }
+ }
+ m_declaredAttributes = declaredAttributes;
m_attributes = attributes;
+ }
+
+ /**
+ * Return the declared attributes associated with descriptor.
+ *
+ * @return the declared attributes associated with descriptor.
+ */
+ public Attribute[] getDeclaredAttributes()
+ {
+ return m_declaredAttributes;
}
/**
1.7 +2 -2 spice/sandbox/metaclass/src/java/org/realityforge/metaclass/model/FieldDescriptor.java
Index: FieldDescriptor.java
===================================================================
RCS file: /cvsroot/spice/spice/sandbox/metaclass/src/java/org/realityforge/metaclass/model/FieldDescriptor.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FieldDescriptor.java 22 Oct 2003 09:19:41 -0000 1.6
+++ FieldDescriptor.java 28 Oct 2003 11:02:02 -0000 1.7
@@ -24,7 +24,7 @@
*
* @author <a href="mailto:peter at realityforge.org">Peter Donald</a>
* @author <a href="mailto:doug at [email protected]">Doug Hagan</a>
- * @version $Revision: 1.6 $ $Date: 2003/10/22 09:19:41 $
+ * @version $Revision: 1.7 $ $Date: 2003/10/28 11:02:02 $
*/
public final class FieldDescriptor
extends FeatureDescriptor
@@ -56,7 +56,7 @@
final String type,
final Attribute[] attributes )
{
- super( attributes );
+ super( attributes, attributes );
if( null == name )
{
throw new NullPointerException( "name" );
1.8 +2 -2 spice/sandbox/metaclass/src/java/org/realityforge/metaclass/model/ClassDescriptor.java
Index: ClassDescriptor.java
===================================================================
RCS file: /cvsroot/spice/spice/sandbox/metaclass/src/java/org/realityforge/metaclass/model/ClassDescriptor.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ClassDescriptor.java 22 Oct 2003 09:19:41 -0000 1.7
+++ ClassDescriptor.java 28 Oct 2003 11:02:02 -0000 1.8
@@ -15,7 +15,7 @@
* the classes methods.
*
* @author <a href="mailto:peter at realityforge.org">Peter Donald</a>
- * @version $Revision: 1.7 $ $Date: 2003/10/22 09:19:41 $
+ * @version $Revision: 1.8 $ $Date: 2003/10/28 11:02:02 $
*/
public class ClassDescriptor
extends FeatureDescriptor
@@ -51,7 +51,7 @@
final FieldDescriptor[] fields,
final MethodDescriptor[] methods )
{
- super( attributes );
+ super( attributes, attributes );
if( null == classname )
{
throw new NullPointerException( "classname" );
-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community? Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/