Author: rich
Date: Tue Mar 15 23:14:32 2005
New Revision: 157713
URL: http://svn.apache.org/viewcvs?view=rev&rev=157713
Log:
Checkpoint of an XDoclet-based Page Flow compiler (to run under JDK1.4).
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/
incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml (with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml.old
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/DelegatingImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/WrapperFactory.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationMirrorImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeElementDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationValueImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ClassDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ConstructorDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ExecutableDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/FieldDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/InterfaceDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MemberDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MethodDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/PackageDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ParameterDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/TypeDeclarationImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/MessagerImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/SourcePositionImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/AnnotationTypeImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ArrayTypeImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ClassTypeImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/DeclaredTypeImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/InterfaceTypeImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/PrimitiveTypeImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ReferenceTypeImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeMirrorImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeVariableImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/VoidTypeImpl.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/tasks/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/tasks/SourceCopy.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/xdoclet/
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/xdoclet/Messages.properties
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/xdoclet/NetuiBuildException.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/xdoclet/NetuiDocletTask.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/xdoclet/NetuiSubTask.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/xdoclet/XDocletCompilerUtils.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/xdoclet/XDocletUtils.java
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/xdoclet/disabled/
incubator/beehive/trunk/netui/src/compiler-xdoclet/pageflow-webapp-build.properties
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/pageflow-webapp-build.xml
(with props)
incubator/beehive/trunk/netui/src/compiler-xdoclet/xdoclet-xml.xdt
Added: incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml?view=auto&rev=157713
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml (added)
+++ incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml Tue Mar 15
23:14:32 2005
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+
+<project name="Beehive/NetUI/Compiler (XDoclet)" default="build" basedir=".">
+
+ <import file="../../netui-imports.xml"/>
+
+ <property name="module.name" value="compiler-xdoclet"/>
+ <property name="module.classes.dir" value="${classes.dir}/${module.name}"/>
+ <property name="module.dir" location="${src.dir}/${module.name}"/>
+ <property name="xdoclet-xml.dir" value="${module.classes.dir}/META-INF"/>
+ <property name="xdoclet-xml.template.file"
value="${basedir}/xdoclet-xml.xdt" />
+ <property name="compiler-core.classes.dir"
location="${classes.dir}/compiler-core"/>
+ <property name="pageflow.module.dir" location="${src.dir}/pageflow"/>
+
+ <path id="module.classpath">
+ <path refid="xbean.dependency.path"/>
+ <path refid="commons-logging.dependency.path"/>
+ <path refid="commons-collections.dependency.path"/>
+ <fileset refid="controls.fileset"/>
+ <!-- TODO: put these jars into netui.properties -->
+ <fileset file="${external.dir}/xdoclet/xdoclet-1.2b4.jar"/>
+ <fileset file="${external.dir}/xdoclet/xjavadoc-1.1-j5-v3.jar"/>
+ <pathelement path="${compiler-core.classes.dir}"/>
+ </path>
+
+ <target name="build" depends="compile,xdoclet-xml,jar"/>
+
+ <target name="compile">
+ <echo>compile module: ${module.name}</echo>
+ <property name="classpath" refid="module.classpath"/>
+ <echo>module classpath: ${classpath}</echo>
+ <echo>basedir: ${basedir}</echo>
+
+ <mkdir dir="${module.classes.dir}"/>
+
+ <javac srcdir="${module.dir}"
+ destdir="${module.classes.dir}"
+ classpathref="module.classpath"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}"
+ source="1.4"
+ target="1.4">
+ <include name="**/*.java"/>
+ </javac>
+
+ <copy todir="${module.classes.dir}">
+ <fileset dir="${module.dir}" includes="**/*.properties"/>
+ <fileset dir="${module.dir}" includes="**/*.xml"/>
+ <fileset dir="${module.dir}" includes="META-INF/**"/>
+ <fileset dir="${pageflow.module.dir}" includes="**/Jpf.java"/>
+ </copy>
+ </target>
+
+ <!-- ===================================================================
-->
+ <!-- Generates an xdoclet.xml deployment descriptor for xdoclet modules
-->
+ <!-- ===================================================================
-->
+ <target name="xdoclet-xml"
+ description="Generates an xdoclet.xml deployment descriptor for
xdoclet modules"
+ unless="module.jar.uptodate"
+ depends="compile"
+ >
+ <!--
+ Define classpath required for generating xml descriptors
+ We're including our own classes on the class path because
+ the module might contain a subtask which depends on a doclettask
+ in the same module. all classes have to be on the classpath for
+ the xdoclet.xml generation to succeed. The classpath has to be defined
+ *after* compilation because Ant will strip away nonexistant
+ paths from the classpath. (The class directory doesn't exist before
+ the classes are compiled).
+ -->
+ <!-- Define the xdoclet task -->
+ <taskdef name="xdoclet" classname="xdoclet.DocletTask"
classpathref="module.classpath"/>
+
+ <mkdir dir="${xdoclet-xml.dir}"/>
+ <xdoclet destdir="${xdoclet-xml.dir}">
+
+ <fileset dir="${basedir}">
+ <include name="**/*Handler.java" />
+ <include name="**/*SubTask.java" />
+ </fileset>
+
+ <template
+ templateFile="${xdoclet-xml.template.file}"
+ destinationFile="xdoclet.xml"
+ />
+ </xdoclet>
+ </target>
+
+ <target name="jar">
+ <!-- copy class files from the compiler-core module -->
+ <copy todir="${module.classes.dir}">
+ <fileset dir="${compiler-core.classes.dir}" includes="**/*"/>
+ </copy>
+
+ <jar jarfile="${build.lib.dir}/${compiler-xdoclet.jar.name}"
basedir="${module.classes.dir}">
+ <manifest>
+ <attribute name="Class-Path" value="apache-xbean.jar"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete dir="${module.classes.dir}"/>
+ <delete file="${build.lib.dir}/${compiler-xdoclet.jar.name}"/>
+ </target>
+
+</project>
Propchange: incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml.old
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml.old?view=auto&rev=157713
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml.old (added)
+++ incubator/beehive/trunk/netui/src/compiler-xdoclet/build.xml.old Tue Mar 15
23:14:32 2005
@@ -0,0 +1,191 @@
+<?xml version="1.0"?>
+
+<project name="NetUI/XDoclet Compiler" default="compile" basedir=".">
+
+ <property name="module.classpath"
value="${pageflow.jar};${compiler.jar};${commons-logging.jar};${commons-collections.jar};${xdoclet.jar};${xjavadoc.jar};${xbean.jar}"/>
+
+ <!-- Module specific properties used by the xdoclet portions of the build
-->
+ <property name="module.build.dir"
value="${classes.dir}/${module.name}"/>
+ <property name="module.jar.file"
value="${dist.dir}/xdoclet-${ant.project.name}-module-${version}.jar"/>
+ <property name="xdoclet-xml.dir"
value="${module.build.dir}/META-INF"/>
+ <property name="module.tag.docs.file"
value="${docs.tags.dir}/${ant.project.name}-tags.xml"/>
+ <property name="xdoclet-xml.template.file"
value="${basedir}/xdoclet-xml.xdt" />
+
+
+ <!-- ===================================================================
-->
+ <!-- Initialises the build.
-->
+ <!-- ===================================================================
-->
+ <target name="init">
+ <!-- Define classpath required for compiling modules -->
+ <path id="module.compile.class.path">
+ <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+
+ <fileset dir="${dist.dir}">
+ <!-- include previously built jars -->
+ <include name="*.jar"/>
+ </fileset>
+
+ <!-- Include core classes, might not have been jarred yet -->
+ <!-- pathelement location="${core.classes.dir}"/ -->
+ <pathelement location="${xdoclet.jar}" />
+ </path>
+
+ <mkdir dir="${module.build.dir}"/>
+
+ <path id="module.xml.class.path">
+ <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${dist.dir}">
+ <!-- include previously built jars -->
+ <include name="*.jar"/>
+ </fileset>
+ <!-- include classes from this module -->
+ <pathelement location="${module.build.dir}"/>
+ <!-- include resources from this module -->
+ <pathelement location="${basedir}"/>
+
+ <!--
+ Include classes from the core. The core is also a module,
+ since it contains an xdoclet.xml and core taghandlers.
+ This is required only because of the externalizer, which
+ is invoked by the core build before the xdoclet.jar file
+ is assembled.
+ -->
+ <!-- pathelement location="${core.classes.dir}"/ -->
+ <pathelement location="${xdoclet.jar}" />
+ </path>
+
+ <condition property="file.url.prefix" value="file://">
+ <os family="unix" />
+ </condition>
+ <condition property="file.url.prefix" value="file:/">
+ <os family="windows" />
+ </condition>
+
+ <!-- Checks if the module jar is uptodate -->
+ <uptodate property="module.jar.uptodate"
targetfile="${module.jar.file}">
+ <srcfiles dir="${basedir}"/>
+ </uptodate>
+
+ </target>
+
+
+ <!-- ===================================================================
-->
+ <!-- Generates an xdoclet.xml deployment descriptor for xdoclet modules
-->
+ <!-- ===================================================================
-->
+ <target name="xdoclet-xml"
+ description="Generates an xdoclet.xml deployment descriptor for
xdoclet modules"
+ unless="module.jar.uptodate"
+ depends="sub-compile"
+ >
+ <!--
+ Define classpath required for generating xml descriptors
+ We're including our own classes on the class path because
+ the module might contain a subtask which depends on a doclettask
+ in the same module. all classes have to be on the classpath for
+ the xdoclet.xml generation to succeed. The classpath has to be defined
+ *after* compilation because Ant will strip away nonexistant
+ paths from the classpath. (The class directory doesn't exist before
+ the classes are compiled).
+ -->
+ <!-- Define the xdoclet task -->
+ <taskdef name="xdoclet" classname="xdoclet.DocletTask"
+ classpath="${module.classpath}"
+ />
+
+ <mkdir dir="${xdoclet-xml.dir}"/>
+ <xdoclet destdir="${xdoclet-xml.dir}">
+
+ <fileset dir="${basedir}">
+ <include name="**/*Handler.java" />
+ <include name="**/*SubTask.java" />
+ </fileset>
+
+ <template
+ templateFile="${xdoclet-xml.template.file}"
+ destinationFile="xdoclet.xml"
+ />
+ </xdoclet>
+ </target>
+
+ <!-- the main task; this will run the XDoclet validation, compile the
classes, run the XDoclet xml gen, and jar it all up -->
+ <target name="compile" depends="sub-compile,xdoclet-xml,jar" />
+
+ <target name="sub-compile" >
+ <echo>Compile module: ${module.name}</echo>
+ <echo>module.classpath: ${module.classpath}</echo>
+ <echo>dist.dir=${dist.dir}</echo>
+ <echo>Debug=${compile.debug}</echo>
+
+ <mkdir dir="${classes.dir}/${module.name}"/>
+
+ <javac srcdir="."
+ destdir="${classes.dir}/${module.name}"
+ classpath="${module.classpath}"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}"
+ source="${compile.source}">
+ <include name="**/*.java"/>
+ </javac>
+ <copy todir="${classes.dir}/${module.name}">
+ <fileset dir="." >
+ <include name="**/*.properties"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.xdt"/>
+ <include name="**/*.xml"/>
+ <exclude name="**/xdoclet-xml.xdt" />
+ <exclude name="**/build.xml" />
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="jar" depends="sub-compile, xdoclet-xml">
+ <jar jarfile="${dist.tomcat.dir}/${xdoclet-compiler.jar.name}">
+ <fileset dir="${classes.dir}/${module.name}">
+ <include name="**/*.class"/>
+ <include name="**/*.properties"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.xdt"/>
+ <include name="**/*.xml"/>
+ </fileset>
+
+ <!-- Include com.bea.wlw.netui.pageflow.model from the compiler
module.
+ <fileset dir="${classes.dir}/compiler">
+ <include name="com/bea/wlw/netui/pageflow/model/**/*.class"/>
+ <include name="com/bea/wlw/netui/pageflow/schema/**/*.class"/>
+ <include name="schema/**/*.class"/>
+ <include
name="com/bea/wlw/netui/pageflow/compiler/*Constants*.class"/>
+ <include
name="com/bea/wlw/netui/pageflow/compiler/*.properties"/>
+ <include name="**/*.xsd"/>
+ <include name="**/*.xsb"/>
+ </fileset>
+ -->
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete dir="${classes.dir}/${module.name}"/>
+ <delete file="${dist.tomcat.dir}/${xdoclet-compiler.jar.name}"
failonerror="false"/>
+ </target>
+
+ <target name="javadoc">
+ <mkdir dir="${javadoc.dir}/${module.name}"/>
+ <javadoc packagenames="${javadoc.packages}"
+ sourcepath="."
+ destdir="${javadoc.dir}/${module.name}"
+ version="true"
+ windowtitle="${javadoc.windowtitle}"
+ >
+ <link href="${j2ee.docs}"/>
+ </javadoc>
+ </target>
+
+ <target name="clean.javadoc">
+ <delete dir="${javadoc.dir}/${module.name}" includeEmptyDirs="true"/>
+ </target>
+
+</project>
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/DelegatingImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/DelegatingImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/DelegatingImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/DelegatingImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl;
+
+public class DelegatingImpl
+{
+ private Object _delegate;
+
+ protected DelegatingImpl( Object delegate )
+ {
+ assert delegate != null;
+ _delegate = delegate;
+ }
+
+ public boolean equals( Object o )
+ {
+ if ( o == null ) return false;
+ if ( o == this ) return true;
+ if ( ! ( o instanceof DelegatingImpl ) ) return false;
+ return _delegate.equals( ( ( DelegatingImpl ) o )._delegate );
+ }
+
+ public int hashCode()
+ {
+ return _delegate.hashCode();
+ }
+
+ public String toString()
+ {
+ return _delegate.toString();
+ }
+
+ protected Object getDelegate()
+ {
+ return _delegate;
+ }
+
+ protected void setDelegate( Object delegate )
+ {
+ _delegate = delegate;
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/DelegatingImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/WrapperFactory.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/WrapperFactory.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/WrapperFactory.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/WrapperFactory.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,242 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl;
+
+import org.apache.beehive.netui.compiler.typesystem.declaration.*;
+import org.apache.beehive.netui.compiler.typesystem.type.ArrayType;
+import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
+import org.apache.beehive.netui.compiler.typesystem.type.DeclaredType;
+import org.apache.beehive.netui.compiler.typesystem.type.InterfaceType;
+import org.apache.beehive.netui.compiler.typesystem.type.PrimitiveType;
+import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror;
+import org.apache.beehive.netui.compiler.typesystem.type.VoidType;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.ClassDeclarationImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.ConstructorDeclarationImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.FieldDeclarationImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.InterfaceDeclarationImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.MethodDeclarationImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.PackageDeclarationImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.ParameterDeclarationImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.type.ArrayTypeImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.type.ClassTypeImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.type.InterfaceTypeImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.type.PrimitiveTypeImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.type.VoidTypeImpl;
+import xjavadoc.*;
+
+import java.util.HashMap;
+import java.util.HashSet;
+
+public class WrapperFactory
+{
+ private static final WrapperFactory INSTANCE = new WrapperFactory();
+ private static final HashSet PRIMITIVE_TYPES = new HashSet();
+
+ static
+ {
+ PRIMITIVE_TYPES.add( "boolean" );
+ PRIMITIVE_TYPES.add( "byte" );
+ PRIMITIVE_TYPES.add( "short" );
+ PRIMITIVE_TYPES.add( "int" );
+ PRIMITIVE_TYPES.add( "long" );
+ PRIMITIVE_TYPES.add( "char" );
+ PRIMITIVE_TYPES.add( "float" );
+ PRIMITIVE_TYPES.add( "double" );
+ }
+
+ private HashMap _classDeclarations = new HashMap();
+
+
+ private WrapperFactory()
+ {
+ }
+
+ public static WrapperFactory get()
+ {
+ return INSTANCE;
+ }
+
+ public TypeMirror getTypeMirror( Type delegate )
+ {
+ if ( delegate == null ) return null;
+
+ if ( delegate.getDimension() > 0 )
+ {
+ return getArrayType( delegate );
+ }
+ else
+ {
+ return getTypeMirror( delegate.getType() );
+ }
+ }
+
+ public TypeMirror getTypeMirror( XClass delegate )
+ {
+ if ( delegate == null ) return null;
+
+ String name = delegate.getName();
+
+ if ( name.equals( "void" ) )
+ {
+ return getVoidType( delegate );
+ }
+ else if ( PRIMITIVE_TYPES.contains( name ) )
+ {
+ return getPrimitiveType( delegate );
+ }
+ else
+ {
+ return getDeclaredType( delegate );
+ }
+ }
+
+ public ArrayType getArrayType( Type delegate )
+ {
+ return new ArrayTypeImpl( delegate );
+ }
+
+ public VoidType getVoidType( XClass delegate )
+ {
+ if ( delegate == null ) return null;
+ return new VoidTypeImpl( delegate );
+ }
+
+ public PrimitiveType getPrimitiveType( XClass delegate )
+ {
+ if ( delegate == null ) return null;
+ return new PrimitiveTypeImpl( delegate );
+ }
+
+ public DeclaredType getDeclaredType( XClass delegate )
+ {
+ if ( delegate == null ) return null;
+ return delegate.isInterface() ? ( DeclaredType ) getInterfaceType(
delegate ) : getClassType( delegate );
+ }
+
+ public ClassType getClassType( XClass delegate )
+ {
+ if ( delegate == null ) return null;
+ return new ClassTypeImpl( delegate );
+ }
+
+ public InterfaceType getInterfaceType( XClass delegate )
+ {
+ if ( delegate == null ) return null;
+ return new InterfaceTypeImpl( delegate );
+ }
+
+ public Declaration getDeclaration( XProgramElement delegate )
+ {
+ if ( delegate == null ) return null;
+
+ if ( delegate instanceof XMember )
+ {
+ return getMemberDeclaration( ( XMember ) delegate );
+ }
+ else
+ {
+ assert delegate instanceof XType : delegate.getClass().getName();
+ return getTypeDeclaration( ( XType ) delegate );
+ }
+ }
+
+ public MemberDeclaration getMemberDeclaration( XMember delegate )
+ {
+ if ( delegate == null ) return null;
+
+ else if ( delegate instanceof XExecutableMember )
+ {
+ return getExecutableDeclaration( ( XExecutableMember ) delegate );
+ }
+ else
+ {
+ assert delegate instanceof XField : delegate.getClass().getName();
+ return getFieldDeclaration( ( XField ) delegate );
+ }
+ }
+
+ public TypeDeclaration getTypeDeclaration( XType delegate )
+ {
+ if ( delegate == null ) return null;
+ assert delegate instanceof XClass : delegate.getClass().getName();
+ XClass xclass = ( XClass ) delegate;
+ return xclass.isInterface() ? ( TypeDeclaration )
getInterfaceDeclaration( xclass ) : getClassDeclaration( xclass );
+ }
+
+ public ClassDeclaration getClassDeclaration( XClass delegate )
+ {
+ if ( delegate == null ) return null;
+
+ String qualifiedName = delegate.getQualifiedName();
+ ClassDeclaration decl = ( ClassDeclaration ) _classDeclarations.get(
qualifiedName );
+ if ( decl != null ) return decl;
+
+ decl = new ClassDeclarationImpl( delegate );
+ _classDeclarations.put( qualifiedName, decl );
+ return decl;
+ }
+
+ public InterfaceDeclaration getInterfaceDeclaration( XClass delegate )
+ {
+ if ( delegate == null ) return null;
+ return new InterfaceDeclarationImpl( delegate );
+ }
+
+ public ExecutableDeclaration getExecutableDeclaration( XExecutableMember
delegate )
+ {
+ if ( delegate == null ) return null;
+
+ if ( delegate instanceof XMethod )
+ {
+ return getMethodDeclaration( ( XMethod ) delegate );
+ }
+
+ assert delegate instanceof XConstructor :
delegate.getClass().getName();
+ return getConstructorDeclaration( ( XConstructor ) delegate );
+ }
+
+ public ParameterDeclaration getParameterDeclaration( XParameter delegate )
+ {
+ if ( delegate == null ) return null;
+ return new ParameterDeclarationImpl( delegate );
+ }
+
+ public PackageDeclaration getPackageDeclaration( XPackage delegate )
+ {
+ if ( delegate == null ) return null;
+ return new PackageDeclarationImpl( delegate );
+ }
+
+ public ConstructorDeclaration getConstructorDeclaration( XConstructor
delegate )
+ {
+ if ( delegate == null ) return null;
+ return new ConstructorDeclarationImpl( delegate );
+ }
+
+ public MethodDeclaration getMethodDeclaration( XMethod delegate )
+ {
+ if ( delegate == null ) return null;
+ return new MethodDeclarationImpl( delegate );
+ }
+
+ public FieldDeclaration getFieldDeclaration( XField delegate )
+ {
+ if ( delegate == null ) return null;
+ return new FieldDeclarationImpl( delegate );
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/WrapperFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationMirrorImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationMirrorImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationMirrorImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationMirrorImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration;
+
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.beehive.netui.compiler.typesystem.type.AnnotationType;
+import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.env.SourcePositionImpl;
+import org.apache.beehive.netui.xdoclet.XDocletCompilerUtils;
+import xjavadoc.XProgramElement;
+import xjavadoc.XTag;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class AnnotationMirrorImpl
+ extends DelegatingImpl
+ implements AnnotationMirror
+{
+
+ private AnnotationType _type;
+ private SourcePosition _sourcePosition;
+
+ // Map<AnnotationTypeElementDeclaration, AnnotationValue>
getElementValues();
+ private HashMap _elementValues;
+
+ public AnnotationMirrorImpl( XTag tag, XProgramElement element,
AnnotationType type, HashMap elementValues )
+ {
+ super( tag );
+ _sourcePosition = SourcePositionImpl.get( tag, element );
+ _type = type;
+ _elementValues = elementValues;
+ }
+
+ public AnnotationType getAnnotationType()
+ {
+ return _type;
+ }
+
+ public SourcePosition getPosition()
+ {
+ return _sourcePosition;
+ }
+
+ public void addElementValue( String memberName, boolean memberIsArray,
Object value, SourcePosition sourcePosition )
+ {
+ AnnotationTypeElementDeclaration elementDecl =
_type.getAnnotationTypeDeclaration().getMember( memberName );
+
+ if ( elementDecl == null )
+ {
+ XDocletCompilerUtils.addError( getPosition(),
"error.no-such-member",
+ new String[]{ memberName,
_type.getAnnotationTypeDeclaration().getQualifiedName() } );
+ }
+ else if ( memberIsArray )
+ {
+ AnnotationValueImpl av = ( AnnotationValueImpl )
_elementValues.get( elementDecl );
+ List list;
+
+ if ( av == null )
+ {
+ list = new ArrayList();
+ av = new AnnotationValueImpl( list, sourcePosition,
elementDecl );
+ _elementValues.put( elementDecl, av );
+ }
+ else
+ {
+ list = ( List ) av.getValue();
+ }
+
+ list.add( new AnnotationValueImpl( value, sourcePosition, null ) );
+ }
+ else
+ {
+ _elementValues.put( elementDecl, new AnnotationValueImpl( value,
sourcePosition, elementDecl ) );
+ }
+ }
+
+ // Map<AnnotationTypeElementDeclaration, AnnotationValue>
getElementValues();
+ public Map getElementValues()
+ {
+ return _elementValues;
+ }
+
+ public boolean equals( Object o )
+ {
+ if ( o == null ) return false;
+ if ( o == this ) return true;
+ if ( ! ( o instanceof AnnotationMirrorImpl ) ) return false;
+ assert false : "didn't finish equals()";
+ return false;
+ }
+
+ public String toString()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public XTag getDelegateXTag()
+ {
+ return ( XTag ) super.getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationMirrorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration;
+
+import org.apache.beehive.netui.compiler.JpfLanguageConstants;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.FieldDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.MethodDeclaration;
+import org.apache.beehive.netui.compiler.typesystem.declaration.Modifier;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.PackageDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
+import org.apache.beehive.netui.compiler.typesystem.type.InterfaceType;
+import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition;
+
+import java.util.HashMap;
+import java.util.Set;
+
+public class AnnotationTypeDeclarationImpl
+ implements AnnotationTypeDeclaration, JpfLanguageConstants
+{
+ private String _annotationName;
+ private String _packageName;
+ private String _intermediateName;
+ private AnnotationTypeElementDeclaration[] _members;
+ private HashMap _membersByName;
+
+ public AnnotationTypeDeclarationImpl( String annotationName, String
interfaceQualifier,
+ String packageName,
AnnotationTypeElementDeclaration[] members )
+ {
+ _annotationName = annotationName;
+ _intermediateName = interfaceQualifier != null ? interfaceQualifier +
annotationName : annotationName;
+ _packageName = packageName;
+ _members = members;
+
+ _membersByName = new HashMap();
+ for ( int i = 0; i < members.length; i++ )
+ {
+ AnnotationTypeElementDeclaration member = members[i];
+ _membersByName.put( member.getSimpleName(), member );
+ }
+ }
+
+ public AnnotationTypeDeclarationImpl( AnnotationTypeDeclarationImpl
source, String annotationName,
+ String interfaceQualifier )
+ {
+ _annotationName = annotationName;
+ _intermediateName = interfaceQualifier != null ? interfaceQualifier +
annotationName : annotationName;
+ _packageName = source._packageName;
+ _members = source._members;
+ _membersByName = source._membersByName;
+ }
+
+ public AnnotationTypeElementDeclaration[] getAnnotationMembers()
+ {
+ return _members;
+ }
+
+ public AnnotationTypeElementDeclaration getMember( String name )
+ {
+ return ( AnnotationTypeElementDeclaration ) _membersByName.get( name );
+ }
+
+ public PackageDeclaration getPackage()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public String getQualifiedName()
+ {
+ return _packageName + '.' + _intermediateName;
+ }
+
+ public InterfaceType[] getSuperinterfaces()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public FieldDeclaration[] getFields()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public MethodDeclaration[] getMethods()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public TypeDeclaration[] getNestedTypes()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public TypeDeclaration getDeclaringType()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public String getDocComment()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public AnnotationMirror[] getAnnotationMirrors()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public Set getModifiers()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public String getSimpleName()
+ {
+ return _annotationName;
+ }
+
+ public String getIntermediateName()
+ {
+ return _intermediateName;
+ }
+
+ public SourcePosition getPosition()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public boolean hasModifier( Modifier modifier )
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public boolean equals( Object o )
+ {
+ if ( o == null ) return false;
+ if ( o == this ) return true;
+ if ( ! ( o instanceof AnnotationTypeDeclarationImpl ) ) return false;
+ return getQualifiedName().equals( ( ( AnnotationTypeDeclarationImpl )
o ).getQualifiedName() );
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeElementDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeElementDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeElementDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeElementDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration;
+
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue;
+import org.apache.beehive.netui.compiler.typesystem.declaration.Modifier;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.ParameterDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
+import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror;
+import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import org.apache.beehive.netui.xdoclet.NetuiSubTask;
+import org.apache.beehive.netui.xdoclet.XDocletCompilerUtils;
+import xjavadoc.Type;
+import xjavadoc.XClass;
+
+import java.util.Set;
+import java.util.HashSet;
+
+public class AnnotationTypeElementDeclarationImpl
+ implements AnnotationTypeElementDeclaration
+{
+ private String _name;
+ private TypeMirror _type;
+ private String _typeName;
+ private AnnotationValue _defaultVal;
+ private HashSet _validValues;
+
+ public AnnotationTypeElementDeclarationImpl( String name, String typeName,
Object defaultVal, HashSet validValues )
+ {
+ _name = name;
+ _typeName = typeName;
+ if ( defaultVal != null ) _defaultVal = new AnnotationValueImpl(
defaultVal, null, this );
+ _validValues = validValues;
+ }
+
+ public boolean isValidValue( Object value )
+ {
+ return _validValues == null || _validValues.contains( value );
+ }
+
+ public Set getValidValues()
+ {
+ return _validValues;
+ }
+
+ public AnnotationValue getDefaultValue()
+ {
+ return _defaultVal;
+ }
+
+ public TypeMirror getReturnType()
+ {
+ if ( _typeName != null )
+ {
+ boolean isArray = false;
+
+ if ( _typeName.endsWith( "[]" ) )
+ {
+ _typeName = _typeName.substring( 0, _typeName.length() - 2 );
+ assert ! _typeName.endsWith( "[]" ) : "don't currently handle
multidimensional arrays: " + _typeName;
+ isArray = true;
+ }
+
+ XClass baseType = XDocletCompilerUtils.getXClass( _typeName );
+ assert ! XDocletCompilerUtils.isUnknownClass( baseType ) :
"unknown type: " + _typeName;
+
+ if ( isArray )
+ {
+ _type = WrapperFactory.get().getArrayType( new
SynthesizedArrayType( baseType, 1 ) );
+ }
+ else
+ {
+ _type = WrapperFactory.get().getTypeMirror( baseType );
+ }
+
+ _typeName = null;
+ }
+
+ return _type;
+ }
+
+ private static class SynthesizedArrayType
+ implements Type
+ {
+ private XClass _baseType;
+ private int _dimension;
+
+ public SynthesizedArrayType( XClass type, int dimension )
+ {
+ _baseType = type;
+ _dimension = dimension;
+ }
+
+ public int getDimension()
+ {
+ return _dimension;
+ }
+
+ public String getDimensionAsString()
+ {
+ StringBuffer buf = new StringBuffer();
+ for ( int i = 0; i < _dimension; ++i )
+ {
+ buf.append( "[]" );
+ }
+ return buf.toString();
+ }
+
+ public XClass getType()
+ {
+ return _baseType;
+ }
+ }
+
+ public ParameterDeclaration[] getParameters()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public TypeDeclaration getDeclaringType()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public AnnotationMirror[] getAnnotationMirrors()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public Set getModifiers()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public String getSimpleName()
+ {
+ return _name;
+ }
+
+ public SourcePosition getPosition()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public boolean hasModifier( Modifier modifier )
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationTypeElementDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationValueImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationValueImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationValueImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationValueImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration;
+
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration;
+import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl;
+import org.apache.beehive.netui.xdoclet.XDocletCompilerUtils;
+
+import java.util.Iterator;
+
+public class AnnotationValueImpl
+ extends DelegatingImpl
+ implements AnnotationValue
+{
+ private SourcePosition _position;
+
+ public AnnotationValueImpl( Object value, SourcePosition position,
AnnotationTypeElementDeclaration decl )
+ {
+ super( value );
+ _position = position;
+
+ if ( decl != null )
+ {
+ assert decl instanceof AnnotationTypeElementDeclarationImpl :
decl.getClass().getName();
+ AnnotationTypeElementDeclarationImpl declImpl = (
AnnotationTypeElementDeclarationImpl ) decl;
+
+ if ( ! declImpl.isValidValue( value ) )
+ {
+ StringBuffer values = new StringBuffer();
+ for ( Iterator i = declImpl.getValidValues().iterator();
i.hasNext(); )
+ {
+ String validValue = ( String ) i.next();
+ values.append( ' ' ).append( validValue );
+ }
+
+ XDocletCompilerUtils.addError( position,
"error.invalid-enum-value",
+ new String[]{ value.toString(),
decl.getSimpleName(), values.toString() } );
+ }
+ }
+ }
+
+ public Object getValue()
+ {
+ return getDelegate();
+ }
+
+ public SourcePosition getPosition()
+ {
+ return _position;
+ }
+
+ public boolean equals( Object o )
+ {
+ return this == o;
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/AnnotationValueImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ClassDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ClassDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ClassDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ClassDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,241 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration;
+
+import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.ConstructorDeclaration;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Collections;
+
+import xjavadoc.XClass;
+import xjavadoc.XConstructor;
+import xjavadoc.XPackage;
+import xjavadoc.XDoc;
+import xjavadoc.XProgramElement;
+import xjavadoc.XJavaDoc;
+
+public class ClassDeclarationImpl
+ extends TypeDeclarationImpl
+ implements ClassDeclaration
+{
+ private ConstructorDeclaration[] _constructors;
+
+ public ClassDeclarationImpl( XClass delegate )
+ {
+ super( delegate );
+ }
+
+ public ClassType getSuperclass()
+ {
+ return WrapperFactory.get().getClassType(
getDelegateXClass().getSuperclass() );
+ }
+
+ public ConstructorDeclaration[] getConstructors()
+ {
+ if ( _constructors == null )
+ {
+ Collection delegateCollection =
getDelegateXClass().getConstructors();
+ ConstructorDeclaration[] array = new
ConstructorDeclaration[delegateCollection.size()];
+ int j = 0;
+ for ( Iterator i = delegateCollection.iterator(); i.hasNext(); )
+ {
+ array[j++] = WrapperFactory.get().getConstructorDeclaration( (
XConstructor ) i.next() );
+ }
+
+ if ( array.length == 0 )
+ {
+ XConstructor ctor = new DefaultConstructor(
getDelegateXClass() );
+ ConstructorDeclaration decl =
WrapperFactory.get().getConstructorDeclaration( ctor );
+ _constructors = new ConstructorDeclaration[]{ decl };
+ }
+ else
+ {
+ _constructors = array;
+ }
+ }
+
+ return _constructors;
+ }
+
+ protected XClass getDelegateXClass()
+ {
+ return ( XClass ) super.getDelegate();
+ }
+
+ private static class DefaultConstructor
+ implements XConstructor
+ {
+ private XClass _containingClass;
+
+ public DefaultConstructor( XClass containingClass )
+ {
+ _containingClass = containingClass;
+ }
+
+ public boolean isNative()
+ {
+ return false;
+ }
+
+ public boolean isSynchronized()
+ {
+ return false;
+ }
+
+ public List getParameters()
+ {
+ return Collections.emptyList();
+ }
+
+ public List getThrownExceptions()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public boolean throwsException( String s )
+ {
+ return false;
+ }
+
+ public boolean isConstructor()
+ {
+ return true;
+ }
+
+ public String getSignature( boolean b )
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public String getNameWithSignature( boolean b )
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public String getParameterTypes()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public XClass getContainingClass()
+ {
+ return _containingClass;
+ }
+
+ public XPackage getContainingPackage()
+ {
+ return _containingClass.getContainingPackage();
+ }
+
+ public boolean isFinal()
+ {
+ return false;
+ }
+
+ public boolean isPackagePrivate()
+ {
+ return false;
+ }
+
+ public boolean isPrivate()
+ {
+ return false;
+ }
+
+ public boolean isProtected()
+ {
+ return false;
+ }
+
+ public boolean isAbstract()
+ {
+ return false;
+ }
+
+ public boolean isPublic()
+ {
+ return true;
+ }
+
+ public boolean isStatic()
+ {
+ return false;
+ }
+
+ public String getModifiers()
+ {
+ return "public";
+ }
+
+ public int getModifierSpecifier()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public XDoc getDoc()
+ {
+ return null;
+ }
+
+ public XProgramElement getSuperElement()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public List getSuperInterfaceElements()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public XJavaDoc getXJavaDoc()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public void updateDoc()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public int compareTo( Object o )
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public String getName()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ClassDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ConstructorDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ConstructorDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ConstructorDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ConstructorDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration;
+
+import
org.apache.beehive.netui.compiler.typesystem.declaration.ConstructorDeclaration;
+import xjavadoc.XConstructor;
+
+public class ConstructorDeclarationImpl
+ extends ExecutableDeclarationImpl
+ implements ConstructorDeclaration
+{
+ public ConstructorDeclarationImpl( XConstructor delegate )
+ {
+ super( delegate );
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ConstructorDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native