Return-Path: Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 98995 invoked by uid 500); 20 Aug 2003 23:16:17 -0000 Received: (qmail 98825 invoked from network); 20 Aug 2003 23:16:14 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 20 Aug 2003 23:16:14 -0000 Received: (qmail 26309 invoked by uid 1449); 20 Aug 2003 23:16:16 -0000 Date: 20 Aug 2003 23:16:16 -0000 Message-ID: <20030820231616.26308.qmail@minotaur.apache.org> From: leosutic@apache.org To: jakarta-commons-sandbox-cvs@apache.org Subject: cvs commit: jakarta-commons-sandbox/attributes/xdocs index.xml navigation.xml usage.xml usecases.xml X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N leosutic 2003/08/20 16:16:16 Modified: attributes LICENSE.txt maven.xml project.xml Added: attributes/api project.xml attributes/api/src/java overview.html attributes/api/src/java/org/apache/commons/attributes DefaultCachedRepository.java EmptyCachedRepository.java Indexed.java Inheritable.java package.html RepositoryError.java Util.java attributes/compiler project.xml attributes/compiler/src/java/org/apache/commons/attributes/compiler package.html attributes/site maven.xml project.properties project.xml attributes/site/etc site.jsl stylesheet.css attributes/site/xdocs index.xml navigation.xml attributes/unittest maven.xml project.xml attributes/unittest/src/cl1 TestAttribute.java TestClass.java attributes/unittest/src/cl2 TestAttribute.java TestClass.java attributes/unittest/src/test/org/apache/commons/attributes/test Dependency.java Sample.java Sample2.java SampleIF1.java SampleIF2.java SampleIFJoin.java SampleService.java SuperSample.java ThreadSafe.java Removed: attributes build.xml project.properties attributes/src/java/org/apache/commons/attributes package.html attributes/src/java/org/apache/commons/attributes/impl package.html attributes/src/java/org/apache/commons/attributes/task package.html TagSet.java attributes/src/test/org/apache/commons/attributes/task TagSetTest.java attributes/xdocs index.xml navigation.xml usage.xml usecases.xml Log: Moving in, from Avalon Sandbox. Revision Changes Path 1.2 +1 -5 jakarta-commons-sandbox/attributes/LICENSE.txt Index: LICENSE.txt =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/attributes/LICENSE.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- LICENSE.txt 14 Nov 2002 08:09:55 -0000 1.1 +++ LICENSE.txt 20 Aug 2003 23:16:15 -0000 1.2 @@ -1,13 +1,9 @@ /* - * $Header$ - * $Revision$ - * $Date$ - * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without 1.4 +80 -20 jakarta-commons-sandbox/attributes/maven.xml Index: maven.xml =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/attributes/maven.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- maven.xml 18 Dec 2002 19:00:40 -0000 1.3 +++ maven.xml 20 Aug 2003 23:16:15 -0000 1.4 @@ -1,21 +1,81 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.5 +135 -155 jakarta-commons-sandbox/attributes/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/attributes/project.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- project.xml 18 Dec 2002 19:00:40 -0000 1.4 +++ project.xml 20 Aug 2003 23:16:15 -0000 1.5 @@ -1,156 +1,136 @@ - - - 3 - Commons Attributes - commons-attributes - 0.1 - - - Apache Software Foundation - http://www.apache.org - /images/jakarta-logo-blue.gif - - - - - 2002 - org.apache.commons.attributes - - Provides runtime access to Java metadata attributes. - - - Provides runtime access to Java metadata attributes. - - - http://jakarta.apache.org/commons/sandbox/attributes/ - http://jira.werken.com/BrowseProject.jspa?id=10061 - jakarta.apache.org - /www/jakarta.apache.org/commons/sandbox/attributes/ - /www/jakarta.apache.org/builds/jakarta-commons-sandbox/attributes/ - - scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-commons-sandbox/attributes - http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/attributes/ - - - - - 1.0-beta-1 - 1.0-beta-1 - 1.0-beta-1 - - - - - - - Commons Dev List - commons-dev-subscribe@jakarta.apache.org - commons-dev-unsubscribe@jakarta.apache.org - http://nagoya.apache.org/eyebrowse/SummarizeList?listName=commons-dev@jakarta.apache.org - - - Commons User List - commons-user-subscribe@jakarta.apache.org - commons-user-unsubscribe@jakarta.apache.org - http://nagoya.apache.org/eyebrowse/SummarizeList?listName=commons-user@jakarta.apache.org - - - - - - Jon Tirsen - tirsen - tirsen@users.sourceforge.net - Lecando AB - - - - James Strachan - jstrachan - jstrachan@apache.org - SpiritSoft, Inc. - - - - Ara Abrahamian - ara - ara_e_w@yahoo.com - - - - - - - - qdox - 1.1 - - - - commons-logging - 1.0.2 - - - - ant - 1.5 - + - - - junit - 3.8.1 - - - - xml-apis - 1.0.b2 - - - - xerces - 2.0.2 - - - - - - - commons-dev@jakarta.apache.org - - src/java - - src/test - - - - - - **/*Test.java - - - **/Abstract*.java - - - - src/test - - **/*.xml - **/*.properties - - - - - - - - src/java - - **/*.xml - - - - - \ No newline at end of file + + + 3 + jakarta-commons-attributes + Jakarta Commons Attributes + + + Apache Software Foundation + http://jakarta.apache.org/ + http://jakarta.apache.org/images/jakarta-logo.gif + + + 2003 + + + jakarta-commons-sandbox + + http://jakarta.apache.org/commons/sandbox/attributes/index.html + http://nagoya.apache.org/ + + jakarta.apache.org + ${root.site.directory}/commons/sandbox/attributes + + + + scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-commons-sandbox/attributes + http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/attributes/ + + + + + Jakarta Commons Developer List + commons-dev-subscribe@jakarta.apache.org + commons-dev-unsubscribe@jakarta.apache.org + http://nagoya.apache.org/eyebrowse/SummarizeList?listName=commons-dev@jakarta.apache.org + + + + + + Leo Sutic + leosutic + leosutic@apache.org + Inspire Infrastructure + + All of them. + + + + + + + + + + commons-dev@jakarta.apache.org + ${basedir}/src/java + ${basedir}/src/test + + + + + + **/*TestCase* + + + **/Abstract* + + + + ${basedir}/src/test + + **/*.dtd + **/*.properties + **/*.xinfo + **/*.xtype + **/*.xprofile + **/*.xconfig + **/*.xml + **/*.xservice + **/*.mf + **/*.jar + + + + ${maven.conf.dir} + + **/*.properties + + + + ${basedir}/src/test/conf + + **/* + + + + + + + + + + ${basedir}/src/java + + **/*.dtd + **/*.properties + **/*.xinfo + **/*.xtype + **/*.xprofile + **/*.xconfig + **/*.xml + **/*.xservice + + + + ${basedir}/../ + + LICENSE.txt + + + + ${maven.conf.dir} + BLOCK-INF + + block.xml + + + + + + + + 1.1 jakarta-commons-sandbox/attributes/api/project.xml Index: project.xml =================================================================== ${basedir}/../project.xml jakarta-commons-attributes-api Jakarta Commons Attribute Compiler API org.apache.commons.attributes 0.1 2003 Client API for Jakarta Commons Attributes. A precompiler for java that enables the use of attributes as seen in C#. ${basedir}/target/temp ant ant 1.5 xdoclet+xjavadoc 1.0 commons-collections 2.1 Application Program Interface (API) org.apache.commons.attributes 1.1 jakarta-commons-sandbox/attributes/api/src/java/overview.html Index: overview.html ===================================================================

The Jakarta Commons Attributes projects enables developers to use C#-like attributes in their programs.

What does it do for me?

The Jakarta Commons Attributes project allows you to add objects, called attributes, to your classes, methods and fields:

public class MyAttribute {}
  
  /**
   * @@MyAttribute
   */
  public class MyClass { }

These attributes can then be retrieved at runtime:

Collection attrs = Attributes.getAttributes( MyClass.class );
  
  // Get the first object of the collection
  MyAttribute myAttr = (MyAttribute) attrs.iterator().next(); 
  

Attributes can in turn contain values:

public class Dependency {
  
      private final String name;
      private final Class dependencyClass;
  
      public Dependency( String name, Class dependencyClass ) {
          this.name = name;
          this.dependencyClass = dependencyClass;
      }
  
      public Class getDependencyClass() {
          return this.dependencyClass;
      }
  
      public String getName() {
          return this.name;
      }
  }

This attribute can then be used like this:

/**
   * @@Dependency( "dependency-name", SomeClass.class )
   */
  public class MyClass { }

How do I use it?

The Attributes project provides a precompiler that you must run before you compile your Java classes with Javac (or some other Java compiler). The process goes like this:

  +------------+                              +--------------------+
  |Java Sources|----> Attribute Compiler ---->|Generated Java Files|   
  +------------+                              +--------------------+
        |                                                 |
        |                                                 |
        |               +-------------+                   |
        +-------------->|Java Compiler|<------------------+
                        +-------------+
                               |
                               v
                      +-----------------+
                      |Java .class files|
                      +-----------------+
  

Let's illustrate the above with a short tutorial. Create a new folder and place in it the following files:

build.xml

<project name="jakarta-commons-attributes-demo" default="build" basedir=".">
      
      <path id="build.classpath">
          <pathelement path="jakarta-commons-attributes-api-SNAPSHOT.jar"/>
          <pathelement path="jakarta-commons-attributes-compiler-SNAPSHOT.jar"/>
      </path>
      
      <taskdef name="attribute-compiler" 
          classname="org.apache.commons.attributes.compiler.AttributeCompiler">
          <classpath>
              <path refid="build.classpath"/>
          </classpath>
      </taskdef>
      
      <target name="build">
          <attribute-compiler destDir=".">
              <fileset dir="." includes="*.java"/>
          </attribute-compiler>    
          
          <javac srcdir="." 
              destdir="."
              target="1.3">
              <classpath>
                  <path refid="build.classpath"/>
              </classpath>
          </javac>
      </target>
      
      <target name="run">
          <java fork="yes" classname="Main">
              <classpath>
                  <path refid="build.classpath"/>
                  <pathelement path="."/>
              </classpath>
          </java>
      </target>
  </project>

MyAttribute.java

public class MyAttribute {
      
      public final String value;
      
      public MyAttribute( String value ) {
          this.value = value;
      }
      
      public String getValue () {
          return value;
      }
      
      public String toString () {
          return "[MyAttribute: " + value + "]";
      }
      
  }

Main.java

import java.util.Collection;
  import org.apache.commons.attributes.Attributes;
  
  /**
   * @@MyAttribute( "A value" )
   */
  public class Main {
      
      public static void main (String[] args) {
          Collection attributes = Attributes.getAttributes ( Main.class );
          System.out.println ("The class Main has the following attributes:");
          System.out.println (attributes);
      }
      
  }

Place the two .jar files that the Attribute project consists of (jakarta-commons-attributes-api-SNAPSHOT.jar jakarta-commons-attributes-compiler-SNAPSHOT.jar) in the directory. Then compile everything with:

C:\tutorial>ant
  Buildfile: build.xml
  
  build:
      [javac] Compiling 3 source files to C:\tutorial
  
  BUILD SUCCESSFUL
  Total time: 8 seconds

and run the small demo with:

C:\tutorial>ant run
  Buildfile: build.xml
  
  run:
       [java] The class Main has the following attributes:
       [java] [[MyAttribute: A value]]
  
  BUILD SUCCESSFUL
  Total time: 3 seconds

What happens if I add the same attribute twice?

Let's define the question a bit stricter. Suppose you have an attribute (MyAttribute), and you have a class MyClass:

/**
   * @@MyAttribute
   * @@MyAttribute
   */
  public class MyClass {}

The question is now, will the collection returned by Attributes.getAttributes (MyClass.class) have one or two elements? The answer is that it depends on the way MyAttribute handles equality. The attributes associated with a class, method or field always for a Set, meaning that there are no duplicates. So if MyAttribute is implemented this way:

public class MyAttribute {}

Then you will get two elements, since each instance of MyAttribute is different from every other instance. However, if MyAttribute is implemented like this:

public class MyAttribute {
      public int hashCode () { return 0; }
      public boolean equals (Object o) { return o instanceof MyAttribute; }
  }

That is, every instance of MyAttribute is equal to any other instance of the class, then you will only get one element in the collection.

The above also holds true if the attribute has been inherited.

What syntax is preferred for attributes - @AttributeName or @@AttributeName?

@@AttributeName, since this explicitely tells the compiler that this is an attribute, and eliminates a lot of guesswork.

What are the requirements for an attribute class?

It must have a public constructor. That's all.

I tried adding attributes to an anonymous class and it didn't work.

That's not supported (yet). It is also very hard to implement since the class name is decided by the Java compiler.

How do I add attributes to classes that are generated at runtime (BCEL, dynamic proxies)?

Not supported yet, but probably we'll supply a method like Attributes.registerAttributes (Class clazz, AttributePackage package) that you'll be able to call.

I want to add a constant value as an attribute.

So you have this

public class Values {
      public static final Integer ONE = new Integer (1);
  }

and now you'd like to add ONE as an attribute like this:

/**
   * @@Values.ONE
   */
  public class MyClass { ... }

how can this be done?

The best that can be offered is:

/**
   * @@Integer(Values.ONE)
   */
  public class MyClass { ... }

I'm afraid. The expression follwing the @@ must fit the template "new (expression)" optionally suffixed by "()". This makes the compiler much simpler, and the loss of functionality was considered worth it. You can also define a separate ONE class:

public class One {}

and use it.

1.1 jakarta-commons-sandbox/attributes/api/src/java/org/apache/commons/attributes/DefaultCachedRepository.java Index: DefaultCachedRepository.java =================================================================== package org.apache.commons.attributes; import java.lang.reflect.Field; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.HashSet; import java.util.HashMap; class DefaultCachedRepository implements CachedRepository { private final static Collection EMPTY_COLLECTION = new ArrayList (0); private final Set classAttributes = new HashSet (); private final Map fields = new HashMap (); private final Map methods = new HashMap (); private final Map constructors = new HashMap (); public DefaultCachedRepository (Class clazz, AttributeRepositoryClass repo) { // ---- Fix up class attributes this.classAttributes.addAll (repo.getClassAttributes ()); this.classAttributes.addAll (getInheritableClassAttributes (clazz.getSuperclass ())); Class[] ifs = clazz.getInterfaces (); for (int i = 0; i < ifs.length; i++) { this.classAttributes.addAll (getInheritableClassAttributes (ifs[i])); } // ---- Fix up method attributes Method[] methods = clazz.getDeclaredMethods (); for (int i = 0; i < methods.length; i++) { Method m = methods[i]; String key = Util.getSignature (m); Set attributes = new HashSet (); if (repo.getMethodAttributes ().containsKey (key)) { attributes.addAll ((Collection) repo.getMethodAttributes ().get (key)); } attributes.addAll (getInheritableMethodAttributes (clazz.getSuperclass (), m.getName (), m.getParameterTypes ())); for (int j = 0; j < ifs.length; j++) { attributes.addAll (getInheritableMethodAttributes (ifs[j], m.getName (), m.getParameterTypes ())); } if (attributes.size () > 0) { this.methods.put (m, attributes); } } // --- Just copy constructor attributes (they aren't inherited) Constructor[] constructors = clazz.getDeclaredConstructors (); for (int i = 0; i < constructors.length; i++) { Constructor ctor = constructors[i]; String key = Util.getSignature (ctor); if (repo.getConstructorAttributes ().containsKey (key)) { this.constructors.put (ctor, repo.getConstructorAttributes ().get (key)); } } // --- Just copy field attributes (they aren't inherited) Field[] fields = clazz.getDeclaredFields (); for (int i = 0; i < fields.length; i++) { Field f = fields[i]; String key = f.getName (); if (repo.getFieldAttributes ().containsKey (key)) { this.fields.put (f, repo.getFieldAttributes ().get (key)); } } } private static Collection getInheritableAttributes (Collection attrs) { HashSet result = new HashSet (); Iterator iter = attrs.iterator (); while (iter.hasNext ()) { Object attr = iter.next (); if (Attributes.hasAttributeType (attr.getClass (), Inheritable.class)) { result.add (attr); } } return result; } private static Collection getInheritableClassAttributes (Class c) { if (c == null) { return new ArrayList (0); } HashSet result = new HashSet (); result.addAll (getInheritableAttributes (Attributes.getAttributes (c))); // Traverse the class hierarchy result.addAll (getInheritableClassAttributes (c.getSuperclass ())); // Traverse the interface hierarchy Class[] ifs = c.getInterfaces (); for (int i = 0; i < ifs.length; i++) { result.addAll (getInheritableClassAttributes (ifs[i])); } return result; } private static Collection getInheritableMethodAttributes (Class c, String methodName, Class[] methodParams) { if (c == null) { return new ArrayList (0); } HashSet result = new HashSet (); try { // Get equivalent method in c Method m = c.getMethod (methodName, methodParams); if (m.getDeclaringClass () == c) { result.addAll (getInheritableAttributes (Attributes.getAttributes (m))); } } catch (NoSuchMethodException nsme) { } // Traverse the class hierarchy result.addAll (getInheritableMethodAttributes (c.getSuperclass (), methodName, methodParams)); // Traverse the interface hierarchy Class[] ifs = c.getInterfaces (); for (int i = 0; i < ifs.length; i++) { result.addAll (getInheritableMethodAttributes (ifs[i], methodName, methodParams)); } return result; } public Collection getAttributes () { return classAttributes; } public Collection getAttributes (Field f) { if (fields.containsKey (f)) { return (Collection) fields.get (f); } else { return EMPTY_COLLECTION; } } public Collection getAttributes (Method m) { if (methods.containsKey (m)) { return (Collection) methods.get (m); } else { return EMPTY_COLLECTION; } } public Collection getAttributes (Constructor c) { if (constructors.containsKey (c)) { return (Collection) constructors.get (c); } else { return EMPTY_COLLECTION; } } } 1.1 jakarta-commons-sandbox/attributes/api/src/java/org/apache/commons/attributes/EmptyCachedRepository.java Index: EmptyCachedRepository.java =================================================================== package org.apache.commons.attributes; import java.lang.reflect.Field; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; /** * Null implementation of a cached repository. */ class EmptyCachedRepository implements CachedRepository { private final static Collection EMPTY_COLLECTION = new ArrayList (0); public Collection getAttributes () { return EMPTY_COLLECTION; } public Collection getAttributes (Field f) { return EMPTY_COLLECTION; } public Collection getAttributes (Method m) { return EMPTY_COLLECTION; } public Collection getAttributes (Constructor c) { return EMPTY_COLLECTION; } } 1.1 jakarta-commons-sandbox/attributes/api/src/java/org/apache/commons/attributes/Indexed.java Index: Indexed.java =================================================================== package org.apache.commons.attributes; /** * This attribute is used to mark attributes as being indexed. * Indexed attributes will result in the attribute-jar-index tool * creating an entry for a class marked with an attribute that is indexed. * For example, if the attribute Service is Indexed, and the classes * MyService and MyService2 have Service as a class attribute, the * jar-index will be: * * AttributeType: Service * Class: MyService * Class: MyService2 */ public class Indexed { } 1.1 jakarta-commons-sandbox/attributes/api/src/java/org/apache/commons/attributes/Inheritable.java Index: Inheritable.java =================================================================== package org.apache.commons.attributes; /** * This attribute is used to mark attributes as being inheritable. * Inheritable attributes are inherited down the class and interface * hierarchy. See Dependency for an example of an inheritable attribute. */ public class Inheritable { } 1.1 jakarta-commons-sandbox/attributes/api/src/java/org/apache/commons/attributes/package.html Index: package.html ===================================================================

Provides an API for accessing attributes. 1.1 jakarta-commons-sandbox/attributes/api/src/java/org/apache/commons/attributes/RepositoryError.java Index: RepositoryError.java =================================================================== package org.apache.commons.attributes; /** * Thrown when an attribute repository class can't be * loaded or instantiated. */ public class RepositoryError extends Error { private final Throwable nested; public RepositoryError () { this (null, null); } public RepositoryError (String message) { this (message, null); } public RepositoryError (Throwable nested) { this (nested.toString(), nested); } public RepositoryError (String message, Throwable nested) { super (message); this.nested = nested; } public Throwable getNested () { return nested; } } 1.1 jakarta-commons-sandbox/attributes/api/src/java/org/apache/commons/attributes/Util.java Index: Util.java =================================================================== package org.apache.commons.attributes; import java.lang.reflect.Field; import java.lang.reflect.Constructor; import java.lang.reflect.Method; class Util { public static String getSignature (Method m) { return m.getName () + "(" + getParameterList (m.getParameterTypes ()) + ")"; } public static String getSignature (Constructor c) { return "(" + getParameterList (c.getParameterTypes ()) + ")"; } public static String decodedClassName (String rawName) throws IllegalArgumentException { if (!rawName.startsWith ("[")) { return rawName; } else { StringBuffer nesting = new StringBuffer (); int i = 0; while (rawName.charAt (i) == '[') { nesting.append ("[]"); i++; } String type = ""; switch (rawName.charAt (i)) { case 'B': type = "byte"; break; case 'C': type = "char"; break; case 'D': type = "double"; break; case 'F': type = "float"; break; case 'I': type = "int"; break; case 'J': type = "long"; break; case 'L': type = rawName.substring (i + 1, rawName.length () - 1); break; case 'S': type = "short"; break; case 'Z': type = "boolean"; break; default: throw new IllegalArgumentException ("Can't decode " + rawName); } return type + nesting.toString (); } } public static String getParameterList (Class[] params) { StringBuffer sb = new StringBuffer (); for (int i = 0; i < params.length; i++) { if (i > 0) { sb.append (","); } sb.append (decodedClassName (params[i].getName ())); } return sb.toString (); } } 1.1 jakarta-commons-sandbox/attributes/compiler/project.xml Index: project.xml =================================================================== ${basedir}/../project.xml jakarta-commons-attributes-compiler Jakarta Commons Attribute Compiler Ant Task org.apache.commons.attributes.compiler 0.1 2003 Attribute Compiler An Ant task that will precompile Java source. ant ant 1.5 xdoclet+xjavadoc 1.0 jakarta-commons-attributes jakarta-commons-attributes-api SNAPSHOT Compiler org.apache.commons.attributes.compiler 1.1 jakarta-commons-sandbox/attributes/compiler/src/java/org/apache/commons/attributes/compiler/package.html Index: package.html ===================================================================

Provides an Ant task that preprocesses Java files. The resulting files should then be compiled with the originals in order to enable attributes. 1.1 jakarta-commons-sandbox/attributes/site/maven.xml Index: maven.xml =================================================================== 1.1 jakarta-commons-sandbox/attributes/site/project.properties Index: project.properties =================================================================== # # Banner background and foreground colors. # maven.ui.banner.background = #fff maven.ui.banner.foreground = #000 maven.xdoc.jsl = file:/${basedir}/etc/site.jsl maven.javadoc.stylesheet =${basedir}/etc/stylesheet.css # # Declaration of the remote links to assign on javadoc generation. # Link declarations can be overriden in the user's build.properties # file. # sun.j2se.link = http://java.sun.com/j2se/1.4/docs/api/ maven.javadoc.links = ${sun.j2se.link} 1.1 jakarta-commons-sandbox/attributes/site/project.xml Index: project.xml =================================================================== ${basedir}/../project.xml org.apache.commons.attributes ant 1.5 qdox 1.1 xml-apis 1.0.b2 http://xml.apache.org/xerces2-j/ xerces 2.2.1 http://xml.apache.org/xerces2-j/ maven-changelog-plugin maven-file-activity-plugin maven-developer-activity-plugin maven-changelog-plugin 1.1 jakarta-commons-sandbox/attributes/site/etc/site.jsl Index: site.jsl =================================================================== <x:expr select="$nav/title"/> - ${docTitle} ${pom.name} - ${docTitle}

|
${rowMode} ${attr.value}

Goals

GoalDescription
${rowMode} ${_goalName}
DateAuthorFiles/Message
${rowMode}
${pom.repository.url} ${url}?&content-type=text/vnd.viewcvs-markup - v
1.1 jakarta-commons-sandbox/attributes/site/etc/stylesheet.css Index: stylesheet.css =================================================================== /* Javadoc style sheet */ /* Define colors, fonts and other style attributes here to override the defaults */ /* Page background color */ body { background-color: #FFFFFF } /* Table colors */ .TableHeadingColor { background: #CCCCFF } /* Dark mauve */ .TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ .TableRowColor { background: #FFFFFF } /* White */ /* Font used in left-hand frame lists */ .FrameTitleFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif } .FrameHeadingFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif } .FrameItemFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif } /* Example of smaller, sans-serif font in frames */ /* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */ /* Navigation bar fonts and colors */ .NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */ .NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */ .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} 1.1 jakarta-commons-sandbox/attributes/site/xdocs/index.xml Index: index.xml =================================================================== Leo Sutic Jakarta Commons Attributes

Commons Attributes enables Java programmers to use C#/.Net-style attributes in their code.

Please see the Javadoc overview for more information. (I figure it makes more sense to have it there.)

1.1 jakarta-commons-sandbox/attributes/site/xdocs/navigation.xml Index: navigation.xml =================================================================== Jakarta Commons Attributes 1.1 jakarta-commons-sandbox/attributes/unittest/maven.xml Index: maven.xml =================================================================== 1.1 jakarta-commons-sandbox/attributes/unittest/project.xml Index: project.xml =================================================================== ${basedir}/../project.xml jakarta-commons-attributes-unittest Jakarta Commons Attribute Compiler Unit Tests org.apache.commons.attributes 0.1 2003 Compiler for Jakarta Commons Attributes in Java. A precompiler for java that enables the use of attributes as seen in C#. ${basedir}/target/temp ant ant 1.5 xdoclet+xjavadoc 1.0 commons-collections 2.1 jakarta-commons-attributes jakarta-commons-attributes-compiler SNAPSHOT jakarta-commons-attributes jakarta-commons-attributes-api SNAPSHOT Application Program Interface (API) org.apache.commons.attributes 1.1 jakarta-commons-sandbox/attributes/unittest/src/cl1/TestAttribute.java Index: TestAttribute.java =================================================================== public class TestAttribute { private final String key; public TestAttribute (String key) { this.key = key; } public String getKey () { return key; } public String toString () { return "[TestAttribute " + key + "]"; } } 1.1 jakarta-commons-sandbox/attributes/unittest/src/cl1/TestClass.java Index: TestClass.java =================================================================== /** * @TestAttribute ("1") */ public class TestClass { } 1.1 jakarta-commons-sandbox/attributes/unittest/src/cl2/TestAttribute.java Index: TestAttribute.java =================================================================== /** * @org.apache.commons.attributes.Indexed */ public class TestAttribute { private final String key; public TestAttribute (String key) { this.key = key; } public String getKey () { return key; } public String toString () { return "[TestAttribute " + key + "]"; } } 1.1 jakarta-commons-sandbox/attributes/unittest/src/cl2/TestClass.java Index: TestClass.java =================================================================== /** * @TestAttribute ("2") */ public class TestClass { /** * @TestAttribute ("2inner") */ public static class Inner {} } 1.1 jakarta-commons-sandbox/attributes/unittest/src/test/org/apache/commons/attributes/test/Dependency.java Index: Dependency.java =================================================================== package org.apache.commons.attributes.test; /** * Declares a dependency. * * @org.apache.commons.attributes.Inheritable */ public class Dependency { private final Class clazz; private final String name; public Dependency (Class clazz, String name) { this.clazz = clazz; this.name = name; } public Class getDependencyClass () { return clazz; } public String getDependencyName () { return name; } public boolean equals (Object o) { return o instanceof Dependency && ((Dependency) o).clazz == clazz && ((Dependency) o).name.equals (name); } public int hashCode () { return clazz.hashCode () ^ name.hashCode (); } public String toString () { return "[Dependency on " + clazz.getName () + " via name \"" + name + "\"]"; } } 1.1 jakarta-commons-sandbox/attributes/unittest/src/test/org/apache/commons/attributes/test/Sample.java Index: Sample.java =================================================================== package org.apache.commons.attributes.test; /** * @ThreadSafe () * @Dependency ( SampleService.class, "sample" ) */ public class Sample extends SuperSample implements SampleIFJoin { /** * @ThreadSafe () */ public Object field; public Object noAttributesInSubClass; /** * @Dependency ( SampleService.class, "sample-some-method1" ) */ public void someMethod () { } /** * @@Dependency ( SampleService.class, "sample-some-method2" ) */ public void someMethod (int parameter) { } public void methodWithNoAttributes () { } /** * @@Dependency ( SampleService.class, "inner-sample" ) */ public static class InnerSample { } } 1.1 jakarta-commons-sandbox/attributes/unittest/src/test/org/apache/commons/attributes/test/Sample2.java Index: Sample2.java =================================================================== package org.apache.commons.attributes.test; public class Sample2 { public Object aaaa; public Sample2 () { } public Sample2 (String input) { } public void someMethod () { } public void someMethod (int parameter) { } } 1.1 jakarta-commons-sandbox/attributes/unittest/src/test/org/apache/commons/attributes/test/SampleIF1.java Index: SampleIF1.java =================================================================== package org.apache.commons.attributes.test; /** * @Dependency ( SampleService.class, "sample-if-1-c" ) */ public interface SampleIF1 { /** * @Dependency ( SampleService.class, "sample-if-1" ) * @ThreadSafe () */ public void someMethod (int parameter); } 1.1 jakarta-commons-sandbox/attributes/unittest/src/test/org/apache/commons/attributes/test/SampleIF2.java Index: SampleIF2.java =================================================================== package org.apache.commons.attributes.test; /** * @Dependency ( SampleService.class, "sample-if-2-c" ) */ public interface SampleIF2 { /** * @Dependency ( SampleService.class, "sample-if-2" ) * @ThreadSafe () */ public void someMethod (int parameter); } 1.1 jakarta-commons-sandbox/attributes/unittest/src/test/org/apache/commons/attributes/test/SampleIFJoin.java Index: SampleIFJoin.java =================================================================== package org.apache.commons.attributes.test; public interface SampleIFJoin extends SampleIF1, SampleIF2 { } 1.1 jakarta-commons-sandbox/attributes/unittest/src/test/org/apache/commons/attributes/test/SampleService.java Index: SampleService.java =================================================================== package org.apache.commons.attributes.test; public interface SampleService {} 1.1 jakarta-commons-sandbox/attributes/unittest/src/test/org/apache/commons/attributes/test/SuperSample.java Index: SuperSample.java =================================================================== package org.apache.commons.attributes.test; /** * @Dependency ( SampleService.class, "super-sample" ) */ public class SuperSample { /** * @ThreadSafe () * @Dependency ( SampleService.class, "super-field" ) */ public Object field; /** * @Dependency ( SampleService.class, "super-noattrs" ) */ public Object noAttributesInSubClass; /** * @Dependency ( SampleService.class, "sample-ctor1" ) */ public SuperSample () { } /** * @Dependency ( SampleService.class, "sample-ctor2" ) */ public SuperSample (String input, String[][] array) { } /** * @Dependency ( SampleService.class, "super-some-method-sample" ) * @ThreadSafe () */ public void someMethod (int parameter) { } } 1.1 jakarta-commons-sandbox/attributes/unittest/src/test/org/apache/commons/attributes/test/ThreadSafe.java Index: ThreadSafe.java =================================================================== package org.apache.commons.attributes.test; public class ThreadSafe { public ThreadSafe () { } public boolean equals (Object o) { return o instanceof ThreadSafe; } public int hashCode () { return 0; } public String toString () { return "[ThreadSafe]"; } }