Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,655 @@
+/*
+ * 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.AnnotationValue;
+import org.apache.beehive.netui.compiler.typesystem.declaration.Declaration;
+import org.apache.beehive.netui.compiler.typesystem.declaration.Modifier;
+import org.apache.beehive.netui.compiler.typesystem.type.AnnotationType;
+import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
+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.util.SourcePosition;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.env.SourcePositionImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.type.AnnotationTypeImpl;
+import org.apache.beehive.netui.xdoclet.XDocletCompilerUtils;
+import xjavadoc.XClass;
+import xjavadoc.XDoc;
+import xjavadoc.XProgramElement;
+import xjavadoc.XTag;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StreamTokenizer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+public class DeclarationImpl
+ extends DelegatingImpl
+ implements Declaration, JpfLanguageConstants
+{
+ private static final String VALIDATION_ERROR_FORWARD_TAG_NAME =
"ValidationErrorForward";
+ private static final HashMap MODIFIERS = new HashMap();
+ private static final HashMap MEMBER_ARRAY_ANNOTATIONS = new HashMap();
+ private static final HashMap MEMBER_ANNOTATIONS = new HashMap();
+
+ static
+ {
+ MODIFIERS.put( "abstract", Modifier.ABSTRACT );
+ MODIFIERS.put( "private", Modifier.PRIVATE );
+ MODIFIERS.put( "protected", Modifier.PROTECTED );
+ MODIFIERS.put( "public", Modifier.PUBLIC );
+ MODIFIERS.put( "static", Modifier.STATIC );
+ MODIFIERS.put( "transient", Modifier.TRANSIENT );
+ MODIFIERS.put( "final", Modifier.FINAL );
+ MODIFIERS.put( "synchronized", Modifier.SYNCHRONIZED );
+ MODIFIERS.put( "native", Modifier.NATIVE );
+
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
FORWARD_TAG_NAME, FORWARDS_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
CATCH_TAG_NAME, CATCHES_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
SIMPLE_ACTION_TAG_NAME, SIMPLE_ACTIONS_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
ACTION_OUTPUT_TAG_NAME, ACTION_OUTPUTS_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
CONDITIONAL_FORWARD_TAG_NAME, CONDITIONAL_FORWARDS_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
MESSAGE_BUNDLE_TAG_NAME, MESSAGE_BUNDLES_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
MESSAGE_ARG_TAG_NAME, MESSAGE_ARGS_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_CUSTOM_TAG_NAME, VALIDATE_CUSTOM_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_CUSTOM_VARIABLE_TAG_NAME, VARIABLES_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATION_LOCALE_RULES_TAG_NAME, LOCALE_RULES_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATABLE_PROPERTY_TAG_NAME, VALIDATABLE_PROPERTIES_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATABLE_BEAN_TAG_NAME, VALIDATABLE_BEANS_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
RAISE_ACTION_TAG_NAME, RAISE_ACTIONS_ATTR );
+ MEMBER_ARRAY_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
SHARED_FLOW_REF_TAG_NAME, SHARED_FLOW_REFS_ATTR );
+
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATION_ERROR_FORWARD_TAG_NAME, VALIDATION_ERROR_FORWARD_ATTR );
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_REQUIRED_TAG_NAME, VALIDATE_REQUIRED_ATTR );
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_MIN_LENGTH_TAG_NAME, VALIDATE_MIN_LENGTH_ATTR );
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_MAX_LENGTH_TAG_NAME, VALIDATE_MAX_LENGTH_ATTR );
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_MASK_TAG_NAME, VALIDATE_MASK_ATTR );
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_TYPE_TAG_NAME, VALIDATE_TYPE_ATTR );
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_DATE_TAG_NAME, VALIDATE_DATE_ATTR );
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_RANGE_TAG_NAME, VALIDATE_RANGE_ATTR );
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_CREDIT_CARD_TAG_NAME, VALIDATE_CREDIT_CARD_ATTR );
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_EMAIL_TAG_NAME, VALIDATE_EMAIL_ATTR );
+ MEMBER_ANNOTATIONS.put( ANNOTATION_INTERFACE_PREFIX +
VALIDATE_VALID_WHEN_TAG_NAME, VALIDATE_VALID_WHEN_ATTR );
+ }
+
+ private HashSet _modifiers;
+ private AnnotationMirror[] _annotations;
+
+ public DeclarationImpl( XProgramElement delegate )
+ {
+ super( delegate );
+ ArrayList annotations = getAnnotations( delegate );
+ _annotations = ( AnnotationMirror[] ) annotations.toArray( new
AnnotationMirror[ annotations.size() ] );
+ }
+
+ public String getDocComment()
+ {
+ return getDelegateXProgramElement().getDoc().getCommentText();
+ }
+
+ public AnnotationMirror[] getAnnotationMirrors()
+ {
+ return _annotations;
+ }
+
+ public Set getModifiers()
+ {
+ if ( _modifiers == null )
+ {
+ HashSet modifiers = new HashSet();
+ StringTokenizer tok = new StringTokenizer(
getDelegateXProgramElement().getModifiers() );
+
+ while ( tok.hasMoreTokens() )
+ {
+ String modifierString = tok.nextToken();
+ Modifier modifier = ( Modifier ) MODIFIERS.get( modifierString
);
+ assert modifier != null : "unrecognized modifier: " +
modifierString;
+ modifiers.add( modifier );
+ }
+
+ _modifiers = modifiers;
+ }
+
+ return _modifiers;
+ }
+
+ public String getSimpleName()
+ {
+ return getDelegateXProgramElement().getName();
+ }
+
+ public SourcePosition getPosition()
+ {
+ return SourcePositionImpl.get( getDelegateXProgramElement() );
+ }
+
+ public boolean hasModifier( Modifier modifier )
+ {
+ return getModifiers().contains( modifier );
+ }
+
+ protected XProgramElement getDelegateXProgramElement()
+ {
+ return ( XProgramElement ) super.getDelegate();
+ }
+
+ /** Map of String intermediate-name (e.g., "Jpf.Action") to
AnnotationTypeDeclaration */
+ private static HashMap ANNOTATIONS = new HashMap();
+ private static AnnotationTypeDeclaration[] ALL_ANNOTATIONS;
+
+ static
+ {
+ parseAnnotations();
+ ALL_ANNOTATIONS = ( AnnotationTypeDeclaration[] )
+ ANNOTATIONS.values().toArray( new AnnotationTypeDeclaration[
ANNOTATIONS.size() ] );
+ }
+
+ public static AnnotationTypeDeclaration[] getAllAnnotations()
+ {
+ return ALL_ANNOTATIONS;
+ }
+
+ private static StreamTokenizer getJavaTokenizer( Reader reader )
+ {
+ StreamTokenizer tok = new StreamTokenizer( reader );
+ tok.eolIsSignificant( false );
+ tok.lowerCaseMode( false );
+ tok.parseNumbers();
+ tok.slashSlashComments( true );
+ tok.slashStarComments( true );
+ tok.wordChars( '_', '_' );
+ tok.wordChars( '@', '@' );
+ tok.wordChars( '[', '[' );
+ tok.wordChars( ']', ']' );
+ tok.wordChars( '.', '.' );
+ tok.wordChars( '"', '"' );
+ tok.wordChars( '-', '-' );
+ return tok;
+ }
+
+ private static void parseAnnotations()
+ {
+ try
+ {
+ String annotationsSource = ANNOTATIONS_CLASSNAME.replace( '.', '/'
) + ".java";
+ InputStream in =
DeclarationImpl.class.getClassLoader().getResourceAsStream( annotationsSource );
+ assert in != null : "annotations source not found: " +
annotationsSource;
+ BufferedReader reader = new BufferedReader( new InputStreamReader(
in ) );
+ HashMap enums = new HashMap(); // String enumTypeName -> HashSet
values
+ StreamTokenizer tok = getJavaTokenizer( reader );
+
+
+ String interfaceQualifier = null;
+ String packageName = null;
+
+ while ( tok.nextToken() != StreamTokenizer.TT_EOF )
+ {
+ switch ( tok.ttype )
+ {
+ case StreamTokenizer.TT_WORD:
+ String str = tok.sval;
+
+ if ( packageName == null && str.equals( "package" ) )
+ {
+ packageName = assertWord( tok );
+ }
+ else if ( str.equals( "public" ) )
+ {
+ str = assertWord( tok );
+
+ if ( str.equals( "interface" ) )
+ {
+ interfaceQualifier = assertWord( tok ) + '.';
+ assertChar( tok, '{' );
+ }
+ else if ( str.equals( "@interface" ) )
+ {
+ AnnotationTypeDeclarationImpl ann =
+ readAnnotation( tok,
interfaceQualifier, packageName, enums );
+ ANNOTATIONS.put( ann.getIntermediateName(),
ann );
+
+ //
+ // Special case:
+ // [EMAIL PROTECTED](...)
+ // looks like this in our world:
+ // @Jpf.ValidationErrorForward(...)
+ // Here we dynamically create a new
ValidationErrorForward annotation based on Forward.
+ //
+ if ( ann.getSimpleName().equals(
FORWARD_TAG_NAME ) )
+ {
+ AnnotationTypeDeclarationImpl
validationErrorForwardAnn =
+ new AnnotationTypeDeclarationImpl(
ann, VALIDATION_ERROR_FORWARD_TAG_NAME,
+
interfaceQualifier );
+ ANNOTATIONS.put(
ANNOTATION_INTERFACE_PREFIX + VALIDATION_ERROR_FORWARD_TAG_NAME,
+ validationErrorForwardAnn
);
+ }
+ }
+ else if ( str.equals( "enum" ) )
+ {
+ readEnum( tok, enums );
+ }
+ }
+ else if ( str.charAt( 0 ) == '@' )
+ {
+ ignoreAnnotation( tok );
+ }
+ break;
+
+ case StreamTokenizer.TT_NUMBER:
+ break;
+
+ default:
+ char c = ( char ) tok.ttype;
+
+ if ( c == '}' )
+ {
+ assert interfaceQualifier != null;
+ interfaceQualifier = null;
+ }
+ }
+ }
+
+ reader.close();
+ }
+ catch ( IOException e )
+ {
+ assert false : e;
+ }
+ }
+
+ private static String assertWord( StreamTokenizer tok )
+ throws IOException
+ {
+ tok.nextToken();
+ assert tok.ttype == StreamTokenizer.TT_WORD : tok.ttype;
+ return tok.sval;
+ }
+
+ private static void assertChar( StreamTokenizer tok, char c )
+ throws IOException
+ {
+ tok.nextToken();
+ assert tok.ttype == c : tok.ttype;
+ }
+
+ private static AnnotationTypeDeclarationImpl readAnnotation(
StreamTokenizer tok, String interfaceQualifier,
+ String
packageName, HashMap enums )
+ throws IOException
+ {
+ String annotationName = assertWord( tok );
+ ArrayList memberDecls = new ArrayList();
+ assertChar( tok, '{' );
+
+ while ( tok.nextToken() == StreamTokenizer.TT_WORD )
+ {
+ String memberType = tok.sval;
+ HashSet enumVals = ( HashSet ) enums.get( memberType );
+
+ tok.nextToken();
+ if ( tok.ttype == '<' ) // ignore generics
+ {
+ while ( tok.nextToken() != '>' )
+ {
+ assert tok.ttype != StreamTokenizer.TT_EOF;
+ assert tok.ttype != ';';
+ }
+ tok.nextToken();
+ }
+ assert tok.ttype == StreamTokenizer.TT_WORD;
+ String memberName = tok.sval;
+ assertChar( tok, '(' );
+ assertChar( tok, ')' );
+
+ Object defaultVal = null;
+
+ if ( tok.nextToken() == StreamTokenizer.TT_WORD )
+ {
+ assert tok.sval.equals( "default" );
+
+ tok.nextToken();
+ if ( tok.ttype == '{' )
+ {
+ assertChar( tok, '}' );
+ defaultVal = new ArrayList();
+ }
+ else
+ {
+ assert tok.ttype == StreamTokenizer.TT_WORD || tok.ttype
== StreamTokenizer.TT_NUMBER : tok.ttype;
+
+ if ( tok.ttype == StreamTokenizer.TT_NUMBER )
+ {
+ defaultVal = getNumericDefaultVal( memberType,
tok.nval );
+ }
+ else
+ {
+ String defaultString = tok.sval;
+
+ if ( defaultString.charAt( 0 ) == '@' )
+ {
+ // It's a default value that is an annotation. We
ignore these for now.
+ ignoreAnnotation( tok );
+ }
+ else
+ {
+ if ( memberType.equals( "String" ) )
+ {
+ assert defaultString.charAt( 0 ) == '"' :
defaultString;
+ int len = defaultString.length();
+ assert len > 1 && defaultString.charAt( len -
1 ) == '"' : defaultString;
+ defaultVal = defaultString.substring( 0, len -
1 );
+ }
+ else if ( memberType.equals( "boolean" ) )
+ {
+ defaultVal = Boolean.valueOf( defaultString );
+ }
+ else if ( memberType.equals( "Class") )
+ {
+ assert defaultString.endsWith( ".class" );
+ defaultVal = defaultString.substring( 0,
defaultString.indexOf( ".class" ) );
+ }
+ else
+ {
+ defaultVal = readDefaultEnumVal(
defaultString, memberType, enumVals );
+ }
+ }
+ }
+ }
+
+ tok.nextToken();
+ }
+
+ assert tok.ttype == ';';
+
+ if ( enumVals != null ) memberType = "String";
+ memberDecls.add( new AnnotationTypeElementDeclarationImpl(
memberName, memberType, defaultVal, enumVals ) );
+ }
+
+ assert tok.ttype == '}';
+
+ AnnotationTypeElementDeclaration[] memberArray = (
AnnotationTypeElementDeclaration[] )
+ memberDecls.toArray( new AnnotationTypeElementDeclaration[
memberDecls.size() ] );
+ return new AnnotationTypeDeclarationImpl( annotationName,
interfaceQualifier, packageName, memberArray );
+ }
+
+ private static String readDefaultEnumVal( String defaultString, String
memberType, HashSet enumVals )
+ {
+ int dot = defaultString.indexOf( '.' );
+ assert dot != -1 : "expected an enum value: " + defaultString;
+ String type = defaultString.substring( 0, dot );
+ assert type.equals( memberType ) : "expected enum " + memberType + ",
got " + type;
+ assert enumVals != null : "no enum " + memberType
+ + " defined; currently, enum must be defined
before its use";
+ String defaultVal = defaultString.substring( dot + 1 );
+ assert enumVals.contains( defaultVal ) :
+ "invalid enum field " + defaultVal + " on enum " + type;
+ return defaultVal;
+ }
+
+ private static Object getNumericDefaultVal( String expectedType, double
defaultNumber )
+ {
+ if ( expectedType.equals( "int" ) )
+ {
+ return Integer.valueOf( ( int ) defaultNumber );
+ }
+ else if ( expectedType.equals( "long" ) )
+ {
+ return Long.valueOf( ( long ) defaultNumber );
+ }
+ else if ( expectedType.equals( "float" ) )
+ {
+ return Float.valueOf( ( float ) defaultNumber );
+ }
+ else if ( expectedType.equals( "double" ) )
+ {
+ return Double.valueOf( defaultNumber );
+ }
+
+ assert false : "type " + expectedType + " cannot accept value " +
defaultNumber;
+ return null;
+ }
+
+ private static void ignoreAnnotation( StreamTokenizer tok )
+ throws IOException
+ {
+ while ( tok.nextToken() != ')' )
+ {
+ assert tok.ttype != StreamTokenizer.TT_EOF;
+ assert tok.ttype != ';';
+ }
+ }
+
+ private static void readEnum( StreamTokenizer tok, HashMap enums )
+ throws IOException
+ {
+ String enumName = assertWord( tok );
+
+ assertChar( tok, '{' );
+ HashSet fieldNames = new HashSet();
+
+ while ( true )
+ {
+ fieldNames.add( assertWord( tok ) );
+ tok.nextToken();
+ if ( tok.ttype == '}' ) break;
+ assert tok.ttype == ',' : tok.ttype; // for now, we only do
very simple enums.
+ }
+
+ enums.put( enumName, fieldNames );
+ }
+
+ /**
+ * Get all the annotations for the given element.
+ * @param element the element (class, method, etc.) to examine
+ * @return an ArrayList of AnnotationMirrors.
+ */
+ private static ArrayList getAnnotations( XProgramElement element )
+ {
+ XDoc doc = element.getDoc();
+ ArrayList annotations = new ArrayList();
+ List tags = doc != null ? doc.getTags() : null;
+ ArrayList parentAnnotations = new ArrayList(); // hierarchy of parent
annotations, e.g., Action -> Forward -> ...
+
+ if ( tags == null ) return annotations;
+
+ for ( Iterator i = tags.iterator(); i.hasNext(); )
+ {
+ XTag tag = ( XTag ) i.next();
+ AnnotationTypeDeclaration decl = ( AnnotationTypeDeclaration )
ANNOTATIONS.get( tag.getName() );
+
+ if ( decl != null )
+ {
+ AnnotationType type = new AnnotationTypeImpl( decl );
+ Collection attrNames = tag.getAttributeNames();
+ HashMap elementValues = new HashMap();
+
+ for ( Iterator j = attrNames.iterator(); j.hasNext(); )
+ {
+ String attrName = ( String ) j.next();
+ AnnotationTypeElementDeclaration memberDecl =
decl.getMember( attrName );
+ SourcePosition pos = SourcePositionImpl.get( tag,
attrName, element );
+ Object val = parseValue( memberDecl,
tag.getAttributeValue( attrName ), pos );
+ AnnotationValue value = new AnnotationValueImpl( val, pos,
memberDecl );
+ elementValues.put( memberDecl, value );
+ }
+
+ AnnotationMirrorImpl ann = new AnnotationMirrorImpl( tag,
element, type, elementValues );
+
+ String memberName = ( String ) MEMBER_ARRAY_ANNOTATIONS.get(
tag.getName() );
+
+ if ( memberName != null )
+ {
+ addAnnotationToParent( annotations, ann, memberName, true,
parentAnnotations );
+ }
+ else if ( ( memberName = ( String ) MEMBER_ANNOTATIONS.get(
tag.getName() ) ) != null )
+ {
+ addAnnotationToParent( annotations, ann, memberName,
false, parentAnnotations );
+ }
+ else
+ {
+ annotations.add( ann );
+ }
+
+ for ( int j = 0, len = parentAnnotations.size(); j < len; ++j )
+ {
+ AnnotationMirrorImpl parentAnn = ( AnnotationMirrorImpl )
parentAnnotations.get( j );
+
+ if ( parentAnn.getAnnotationType().equals(
ann.getAnnotationType() ) )
+ {
+ // We found an annotation of this type in the
hierarchy of parent annotations.
+ // Replace it and blow away everything after it.
+ for ( int k = j; k < len; ++k )
+ {
+ parentAnnotations.remove( j );
+ }
+ break;
+ }
+ }
+
+ parentAnnotations.add( ann );
+ }
+ }
+
+ return annotations;
+ }
+
+ private static void addAnnotationToParent( ArrayList annotations,
AnnotationMirrorImpl ann, String memberArrayName,
+ boolean memberIsArray,
ArrayList parentAnnotations )
+ {
+ if ( annotations.size() == 0 )
+ {
+ XDocletCompilerUtils.addError( ann.getPosition(),
"error.no-parent-annotation",
+ new String[]{
ann.getAnnotationType().getAnnotationTypeDeclaration().getQualifiedName() } );
+ }
+ else
+ {
+ AnnotationMirrorImpl foundTheRightParent = null;
+
+ //
+ // Look through the hierarchy of parent annotations, for the first
one that can accept the given annotation
+ // as a child.
+ //
+ for ( int i = parentAnnotations.size() - 1; i >= 0; --i )
+ {
+ AnnotationMirrorImpl parentAnnotation = ( AnnotationMirrorImpl
) parentAnnotations.get( i );
+ AnnotationTypeElementDeclaration elementDecl =
+
parentAnnotation.getAnnotationType().getAnnotationTypeDeclaration().getMember(
memberArrayName );
+
+ if ( elementDecl != null )
+ {
+ foundTheRightParent = parentAnnotation;
+
+ //
+ // Blow away everything past the found parent annotation
in the hierarchy.
+ //
+ for ( int j = i + 1; j < parentAnnotations.size(); ++j )
+ {
+ parentAnnotations.remove( i + 1 );
+ }
+
+ break;
+ }
+ }
+
+ if ( foundTheRightParent != null )
+ {
+ foundTheRightParent.addElementValue( memberArrayName,
memberIsArray, ann, ann.getPosition() );
+ }
+ else
+ {
+ XDocletCompilerUtils.addError( ann.getPosition(),
"error.no-parent-annotation",
+ new String[]{
ann.getAnnotationType().getAnnotationTypeDeclaration().getQualifiedName() } );
+ }
+ }
+ }
+
+ private static Object parseValue( AnnotationTypeElementDeclaration
memberDecl, String strValue, SourcePosition pos )
+ {
+ TypeMirror type = memberDecl.getReturnType();
+
+ if ( type instanceof ClassType )
+ {
+ ClassType classType = ( ClassType ) type;
+ String typeName =
classType.getClassTypeDeclaration().getQualifiedName();
+
+ if ( typeName.equals( "java.lang.String" ) )
+ {
+ return strValue;
+ }
+ else if ( typeName.equals( "java.lang.Class" ) )
+ {
+ XClass classValue = XDocletCompilerUtils.getXClass( strValue );
+
+ if ( XDocletCompilerUtils.isUnknownClass( classValue ) )
+ {
+ XDocletCompilerUtils.addError( pos, "error.unknown-class",
+ new String[]{ strValue,
memberDecl.getSimpleName() } );
+ }
+
+ return WrapperFactory.get().getTypeMirror( classValue );
+ }
+ else
+ {
+ assert false : "unexpected type in annotation declaration: " +
typeName;
+ }
+ }
+
+ assert type instanceof PrimitiveType : type.getClass().getName();
+ switch ( ( ( PrimitiveType ) type ).getKind().asInt() )
+ {
+ case PrimitiveType.Kind.INT_BOOLEAN:
+ return Boolean.valueOf( strValue );
+
+ case PrimitiveType.Kind.INT_BYTE:
+ return new Byte( strValue );
+
+ case PrimitiveType.Kind.INT_SHORT:
+ return new Short( strValue );
+
+ case PrimitiveType.Kind.INT_INT:
+ return new Integer( strValue );
+
+ case PrimitiveType.Kind.INT_LONG:
+ return new Long( strValue );
+
+ case PrimitiveType.Kind.INT_FLOAT:
+ return new Float( strValue );
+
+ case PrimitiveType.Kind.INT_DOUBLE:
+ return new Double( strValue );
+ }
+
+ assert false : "unrecognized type: " + type.toString();
+ return null;
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/DeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ExecutableDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ExecutableDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ExecutableDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ExecutableDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,62 @@
+/*
+ * 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.ExecutableDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.ParameterDeclaration;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import xjavadoc.XExecutableMember;
+import xjavadoc.XParameter;
+
+public class ExecutableDeclarationImpl
+ extends MemberDeclarationImpl
+ implements ExecutableDeclaration
+{
+ private ParameterDeclaration[] _parameters;
+
+ public ExecutableDeclarationImpl( XExecutableMember delegate )
+ {
+ super( delegate );
+ }
+
+ public ParameterDeclaration[] getParameters()
+ {
+ if ( _parameters == null )
+ {
+ Collection delegateCollection =
getDelegateXExecutableMember().getParameters();
+ ParameterDeclaration[] array = new
ParameterDeclaration[delegateCollection.size()];
+ int j = 0;
+ for ( Iterator i = delegateCollection.iterator(); i.hasNext(); )
+ {
+ array[j++] = WrapperFactory.get().getParameterDeclaration( (
XParameter ) i.next() );
+ }
+ _parameters = array;
+ }
+
+ return _parameters;
+ }
+
+ protected XExecutableMember getDelegateXExecutableMember()
+ {
+ return ( XExecutableMember ) super.getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ExecutableDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/FieldDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/FieldDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/FieldDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/FieldDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,43 @@
+/*
+ * 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.FieldDeclaration;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror;
+import xjavadoc.XField;
+
+public class FieldDeclarationImpl
+ extends MemberDeclarationImpl
+ implements FieldDeclaration
+{
+ public FieldDeclarationImpl( XField delegate )
+ {
+ super( delegate );
+ }
+
+ public TypeMirror getType()
+ {
+ return WrapperFactory.get().getTypeMirror(
getDelegateXField().getType() );
+ }
+
+ public XField getDelegateXField()
+ {
+ return ( XField ) super.getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/FieldDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/InterfaceDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/InterfaceDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/InterfaceDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/InterfaceDeclarationImpl.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.InterfaceDeclaration;
+import xjavadoc.XClass;
+
+public class InterfaceDeclarationImpl
+ extends TypeDeclarationImpl
+ implements InterfaceDeclaration
+{
+ public InterfaceDeclarationImpl( XClass delegate )
+ {
+ super( delegate );
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/InterfaceDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MemberDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MemberDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MemberDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MemberDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,44 @@
+/*
+ * 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.MemberDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import xjavadoc.XProgramElement;
+
+public class MemberDeclarationImpl
+ extends DeclarationImpl
+ implements MemberDeclaration
+{
+ public MemberDeclarationImpl( XProgramElement delegate )
+ {
+ super( delegate );
+ }
+
+ public TypeDeclaration getDeclaringType()
+ {
+ return WrapperFactory.get().getTypeDeclaration(
getDelegateXProgramElement().getContainingClass() );
+ }
+
+ public XProgramElement getDelegateXProgramElement()
+ {
+ return ( XProgramElement ) super.getDelegate();
+ }
+
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MemberDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MethodDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MethodDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MethodDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MethodDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,43 @@
+/*
+ * 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.MethodDeclaration;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror;
+import xjavadoc.XMethod;
+
+public class MethodDeclarationImpl
+ extends ExecutableDeclarationImpl
+ implements MethodDeclaration
+{
+ public MethodDeclarationImpl( XMethod delegate )
+ {
+ super( delegate );
+ }
+
+ public TypeMirror getReturnType()
+ {
+ return WrapperFactory.get().getTypeMirror(
getDelegateXMethod().getReturnType() );
+ }
+
+ public XMethod getDelegateXMethod()
+ {
+ return ( XMethod ) super.getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/MethodDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/PackageDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/PackageDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/PackageDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/PackageDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,68 @@
+/*
+ * 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.PackageDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import xjavadoc.XPackage;
+import xjavadoc.XClass;
+
+public class PackageDeclarationImpl
+ extends DelegatingImpl
+ implements PackageDeclaration
+{
+ private ClassDeclaration[] _classes;
+
+ public PackageDeclarationImpl( XPackage delegate )
+ {
+ super( delegate );
+ }
+
+ public String getQualifiedName()
+ {
+ return getDelegateXPackage().getName();
+ }
+
+ public ClassDeclaration[] getClasses()
+ {
+ if ( _classes == null )
+ {
+ Collection delegateCollection = getDelegateXPackage().getClasses();
+ ClassDeclaration[] array = new
ClassDeclaration[delegateCollection.size()];
+ int j = 0;
+ for ( Iterator i = delegateCollection.iterator(); i.hasNext(); )
+ {
+ array[j++] = WrapperFactory.get().getClassDeclaration( (
XClass ) i.next() );
+ }
+ _classes = array;
+ }
+
+ return _classes;
+ }
+
+ public XPackage getDelegateXPackage()
+ {
+ return ( XPackage ) super.getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/PackageDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ParameterDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ParameterDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ParameterDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ParameterDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,74 @@
+/*
+ * 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.ParameterDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationMirror;
+import org.apache.beehive.netui.compiler.typesystem.declaration.Modifier;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl;
+import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror;
+import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition;
+import xjavadoc.XParameter;
+
+import java.util.Set;
+
+public class ParameterDeclarationImpl
+ extends DelegatingImpl
+ implements ParameterDeclaration
+{
+ public ParameterDeclarationImpl( XParameter delegate )
+ {
+ super( delegate );
+ }
+
+ public TypeMirror getType()
+ {
+ return WrapperFactory.get().getTypeMirror(
getDelegateXParameter().getType() );
+ }
+
+ public AnnotationMirror[] getAnnotationMirrors()
+ {
+ throw new UnsupportedOperationException(
ParameterDeclaration.class.getName() + " cannot have annotations" );
+ }
+
+ public Set getModifiers()
+ {
+ throw new UnsupportedOperationException(
ParameterDeclaration.class.getName() + " does not support modifiers" );
+ }
+
+ public String getSimpleName()
+ {
+ return getDelegateXParameter().getName();
+ }
+
+ public SourcePosition getPosition()
+ {
+ throw new UnsupportedOperationException(
ParameterDeclaration.class.getName() + " does not have SourcePosition" );
+ }
+
+ public boolean hasModifier( Modifier modifier )
+ {
+ throw new UnsupportedOperationException(
ParameterDeclaration.class.getName() + " does not support modifiers" );
+ }
+
+ public XParameter getDelegateXParameter()
+ {
+ return ( XParameter ) super.getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/ParameterDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/TypeDeclarationImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/TypeDeclarationImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/TypeDeclarationImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/TypeDeclarationImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,130 @@
+/*
+ * 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.FieldDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.MethodDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.PackageDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import org.apache.beehive.netui.compiler.typesystem.type.InterfaceType;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import xjavadoc.XClass;
+import xjavadoc.XField;
+import xjavadoc.XMethod;
+
+public class TypeDeclarationImpl
+ extends MemberDeclarationImpl
+ implements TypeDeclaration
+{
+ private InterfaceType[] _superInterfaces;
+ private MethodDeclaration[] _methods;
+ private TypeDeclaration[] _nestedTypes;
+ private FieldDeclaration[] _fields;
+
+ public TypeDeclarationImpl( XClass delegate )
+ {
+ super( delegate );
+ }
+
+ public PackageDeclaration getPackage()
+ {
+ return WrapperFactory.get().getPackageDeclaration(
getDelegateXClass().getContainingPackage() );
+ }
+
+ public String getQualifiedName()
+ {
+ return getDelegateXClass().getQualifiedName();
+ }
+
+ public InterfaceType[] getSuperinterfaces()
+ {
+ if ( _superInterfaces == null )
+ {
+ Collection delegateCollection =
getDelegateXClass().getSuperInterfaceElements();
+ InterfaceType[] array = new
InterfaceType[delegateCollection.size()];
+ int j = 0;
+ for ( Iterator i = delegateCollection.iterator(); i.hasNext(); )
+ {
+ array[j++] = WrapperFactory.get().getInterfaceType( ( XClass )
i.next() );
+ }
+ _superInterfaces = array;
+ }
+
+ return _superInterfaces;
+ }
+
+ public FieldDeclaration[] getFields()
+ {
+ if ( _fields == null )
+ {
+ Collection delegateCollection = getDelegateXClass().getFields();
+ FieldDeclaration[] array = new
FieldDeclaration[delegateCollection.size()];
+ int j = 0;
+ for ( Iterator i = delegateCollection.iterator(); i.hasNext(); )
+ {
+ array[j++] = WrapperFactory.get().getFieldDeclaration( (
XField ) i.next() );
+ }
+ _fields = array;
+ }
+
+ return _fields;
+ }
+
+ public MethodDeclaration[] getMethods()
+ {
+ if ( _methods == null )
+ {
+ Collection delegateCollection = getDelegateXClass().getMethods();
+ MethodDeclaration[] array = new
MethodDeclaration[delegateCollection.size()];
+ int j = 0;
+ for ( Iterator i = delegateCollection.iterator(); i.hasNext(); )
+ {
+ array[j++] = WrapperFactory.get().getMethodDeclaration( (
XMethod ) i.next() );
+ }
+ _methods = array;
+ }
+
+ return _methods;
+ }
+
+ public TypeDeclaration[] getNestedTypes()
+ {
+ if ( _nestedTypes == null )
+ {
+ Collection delegateCollection =
getDelegateXClass().getInnerClasses();
+ TypeDeclaration[] array = new
TypeDeclaration[delegateCollection.size()];
+ int j = 0;
+ for ( Iterator i = delegateCollection.iterator(); i.hasNext(); )
+ {
+ array[j++] = WrapperFactory.get().getTypeDeclaration( ( XClass
) i.next() );
+ }
+ _nestedTypes = array;
+ }
+
+ return _nestedTypes;
+ }
+
+ protected XClass getDelegateXClass()
+ {
+ return ( XClass ) super.getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/TypeDeclarationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,129 @@
+/*
+ * 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.env;
+
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeDeclaration;
+import org.apache.beehive.netui.compiler.typesystem.declaration.Declaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
+import org.apache.beehive.netui.compiler.typesystem.env.Filer;
+import org.apache.beehive.netui.compiler.typesystem.env.Messager;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration.AnnotationTypeDeclarationImpl;
+import org.apache.beehive.netui.xdoclet.NetuiSubTask;
+import org.apache.beehive.netui.xdoclet.XDocletCompilerUtils;
+import xdoclet.DocletContext;
+import xjavadoc.SourceClass;
+import xjavadoc.XDoc;
+import xjavadoc.XJavaDoc;
+
+import java.util.Map;
+
+public class AnnotationProcessorEnvironmentImpl
+ extends DelegatingImpl
+ implements AnnotationProcessorEnvironment
+{
+ private static final Declaration[] EMPTY_DECLARATION_ARRAY = new
Declaration[0];
+
+ private NetuiSubTask _subtask;
+ private SourceClass _sourceClass;
+
+ protected AnnotationProcessorEnvironmentImpl( DocletContext delegate,
NetuiSubTask subtask, SourceClass sourceClass )
+ {
+ super( delegate );
+ _subtask = subtask;
+ _sourceClass = sourceClass;
+ }
+
+ public static AnnotationProcessorEnvironment get( DocletContext delegate,
NetuiSubTask subtask, SourceClass sc )
+ {
+ return delegate != null ? new AnnotationProcessorEnvironmentImpl(
delegate, subtask, sc ) : null;
+ }
+
+ public Map getOptions()
+ {
+ return getDelegateDocletContext().getProperties();
+ }
+
+ public Messager getMessager()
+ {
+ return new MessagerImpl( _sourceClass );
+ }
+
+ public Filer getFiler()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "not implemented" );
+ }
+
+ public TypeDeclaration[] getSpecifiedTypeDeclarations()
+ {
+ /*
+ if ( _specifiedTypeDeclarations == null )
+ {
+ Collection delegateCollection = getXJavaDoc().getSourceClasses();
+ TypeDeclaration[] array = new
TypeDeclaration[delegateCollection.size()];
+ int j = 0;
+ for ( Iterator i = delegateCollection.iterator(); i.hasNext(); )
+ {
+ array[j++] = WrapperFactory.get().getTypeDeclaration( (
SourceClass ) i.next() );
+ }
+ _specifiedTypeDeclarations = array;
+ }
+
+ return _specifiedTypeDeclarations;
+ */
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public TypeDeclaration getTypeDeclaration( String s )
+ {
+ return WrapperFactory.get().getTypeDeclaration(
XDocletCompilerUtils.getXClass( s ) );
+ }
+
+ public Declaration[] getDeclarationsAnnotatedWith(
AnnotationTypeDeclaration decl )
+ {
+ //
+ // Note: for now we only examine the single public source class for
any of the given annotations.
+ //
+ XDoc doc = _sourceClass.getDoc();
+
+ if ( doc != null )
+ {
+ assert decl instanceof AnnotationTypeDeclarationImpl :
decl.getClass().getName();
+ if ( doc.getTag( ( ( AnnotationTypeDeclarationImpl ) decl
).getIntermediateName() ) != null )
+ {
+ return new Declaration[]{
WrapperFactory.get().getTypeDeclaration( _sourceClass ) };
+ }
+ }
+
+ return EMPTY_DECLARATION_ARRAY;
+ }
+
+ public DocletContext getDelegateDocletContext()
+ {
+ return ( DocletContext ) super.getDelegate();
+ }
+
+ protected final XJavaDoc getXJavaDoc()
+ {
+ return _subtask.getXJavaDoc();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/AnnotationProcessorEnvironmentImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/MessagerImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/MessagerImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/MessagerImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/MessagerImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,68 @@
+/*
+ * 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.env;
+
+import org.apache.beehive.netui.compiler.typesystem.env.Messager;
+import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition;
+import org.apache.beehive.netui.xdoclet.NetuiDocletTask;
+import xjavadoc.SourceClass;
+
+public class MessagerImpl
+ implements Messager
+{
+ private String _sourceFilePath;
+
+ protected MessagerImpl( SourceClass sourceClass )
+ {
+ _sourceFilePath = sourceClass.getFile().getPath();
+ }
+
+ public void printError( String s )
+ {
+ NetuiDocletTask.addError( s, _sourceFilePath, -1 );
+ }
+
+ public void printError( SourcePosition sourcePosition, String s )
+ {
+ assert sourcePosition != null;
+ NetuiDocletTask.addError( s, sourcePosition );
+ }
+
+ public void printWarning( String s )
+ {
+ NetuiDocletTask.addWarning( s, _sourceFilePath, -1 );
+ }
+
+ public void printWarning( SourcePosition sourcePosition, String s )
+ {
+ assert sourcePosition != null;
+ NetuiDocletTask.addWarning( s, sourcePosition );
+ }
+
+ public void printNotice( String s )
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public void printNotice( SourcePosition sourcePosition, String s )
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/MessagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/SourcePositionImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/SourcePositionImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/SourcePositionImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/SourcePositionImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,95 @@
+/*
+ * 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.env;
+
+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.XDocletUtils;
+import xjavadoc.SourceClass;
+import xjavadoc.XClass;
+import xjavadoc.XProgramElement;
+import xjavadoc.XTag;
+
+import java.io.File;
+
+public class SourcePositionImpl
+ extends DelegatingImpl
+ implements SourcePosition
+{
+ private SourceClass _outerClass;
+ private int _line = -1;
+ private String _memberName;
+
+ protected SourcePositionImpl( XProgramElement element, SourceClass
outerClass )
+ {
+ super( element );
+ _outerClass = outerClass;
+ }
+
+ protected SourcePositionImpl( XTag tag, SourceClass outerClass )
+ {
+ super( tag );
+ _outerClass = outerClass;
+ _line = tag.getLineNumber();
+ }
+
+ protected SourcePositionImpl( XTag tag, String memberName, SourceClass
outerClass )
+ {
+ super( tag );
+ _outerClass = outerClass;
+ _line = tag.getLineNumber();
+ _memberName = memberName;
+ }
+
+ public static SourcePosition get( XProgramElement element )
+ {
+ if ( element == null ) return null;
+ XClass outerClass = XDocletUtils.getOutermostClass( element );
+ return outerClass instanceof SourceClass ? new SourcePositionImpl(
element, ( SourceClass ) outerClass ) : null;
+ }
+
+ public static SourcePosition get( XTag tag, XProgramElement element )
+ {
+ if ( element == null ) return null;
+ XClass outerClass = XDocletUtils.getOutermostClass( element );
+ return outerClass instanceof SourceClass ? new SourcePositionImpl(
tag, ( SourceClass ) outerClass ) : null;
+ }
+
+ public static SourcePosition get( XTag tag, String memberName,
XProgramElement element )
+ {
+ if ( element == null ) return null;
+ XClass outerClass = XDocletUtils.getOutermostClass( element );
+ return outerClass instanceof SourceClass ? new SourcePositionImpl(
tag, memberName, ( SourceClass ) outerClass ) : null;
+ }
+
+ public File file()
+ {
+ return new File( _outerClass.getFile().getPath() );
+ }
+
+ public int line()
+ {
+ return _line;
+ }
+
+ public int column()
+ {
+ assert false : "NYI";
+ return 0;
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/SourcePositionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/AnnotationTypeImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/AnnotationTypeImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/AnnotationTypeImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/AnnotationTypeImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,64 @@
+/*
+ * 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.type;
+
+import
org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.InterfaceDeclaration;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
+import org.apache.beehive.netui.compiler.typesystem.type.AnnotationType;
+import org.apache.beehive.netui.compiler.typesystem.type.DeclaredType;
+import org.apache.beehive.netui.compiler.typesystem.type.InterfaceType;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl;
+
+public class AnnotationTypeImpl
+ extends DelegatingImpl
+ implements AnnotationType
+{
+ public AnnotationTypeImpl( AnnotationTypeDeclaration decl )
+ {
+ super( decl );
+ }
+
+ public AnnotationTypeDeclaration getAnnotationTypeDeclaration()
+ {
+ return ( AnnotationTypeDeclaration ) getDelegate();
+ }
+
+ public InterfaceDeclaration getInterfaceTypeDeclaration()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public DeclaredType getContainingType()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public InterfaceType[] getSuperinterfaces()
+ {
+ assert false : "NYI";
+ throw new UnsupportedOperationException( "NYI" );
+ }
+
+ public TypeDeclaration getDeclaration()
+ {
+ return ( TypeDeclaration ) getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/AnnotationTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ArrayTypeImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ArrayTypeImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ArrayTypeImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ArrayTypeImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,43 @@
+/*
+ * 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.type;
+
+import org.apache.beehive.netui.compiler.typesystem.type.ArrayType;
+import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import xjavadoc.Type;
+
+public class ArrayTypeImpl
+ extends ReferenceTypeImpl
+ implements ArrayType
+{
+ public ArrayTypeImpl( Type delegate )
+ {
+ super( delegate );
+ }
+
+ public TypeMirror getComponentType()
+ {
+ return WrapperFactory.get().getTypeMirror( getDelegateType().getType()
);
+ }
+
+ public Type getDelegateType()
+ {
+ return ( Type ) super.getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ArrayTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ClassTypeImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ClassTypeImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ClassTypeImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ClassTypeImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,48 @@
+/*
+ * 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.type;
+
+import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
+import
org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import xjavadoc.XClass;
+
+public class ClassTypeImpl
+ extends DeclaredTypeImpl
+ implements ClassType
+{
+ public ClassTypeImpl( XClass delegate )
+ {
+ super( delegate );
+ }
+
+ public ClassType getSuperclass()
+ {
+ return WrapperFactory.get().getClassType(
getDelegateXClass().getSuperclass() );
+ }
+
+ public ClassDeclaration getClassTypeDeclaration()
+ {
+ return WrapperFactory.get().getClassDeclaration( getDelegateXClass() );
+ }
+
+ public XClass getDelegateXClass()
+ {
+ return ( XClass ) super.getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ClassTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/DeclaredTypeImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/DeclaredTypeImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/DeclaredTypeImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/DeclaredTypeImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,54 @@
+/*
+ * 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.type;
+
+import
org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
+import org.apache.beehive.netui.compiler.typesystem.type.DeclaredType;
+import org.apache.beehive.netui.compiler.typesystem.type.InterfaceType;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import xjavadoc.XClass;
+
+public class DeclaredTypeImpl
+ extends ReferenceTypeImpl
+ implements DeclaredType
+{
+ public DeclaredTypeImpl( XClass delegate )
+ {
+ super( delegate );
+ }
+
+ public TypeDeclaration getDeclaration()
+ {
+ return WrapperFactory.get().getTypeDeclaration( getDelegateXClass() );
+ }
+
+ public DeclaredType getContainingType()
+ {
+ return WrapperFactory.get().getDeclaredType(
getDelegateXClass().getContainingClass() );
+ }
+
+ public InterfaceType[] getSuperinterfaces()
+ {
+ return WrapperFactory.get().getDeclaredType(
getDelegateXClass().getContainingClass() ).getSuperinterfaces();
+ }
+
+ public XClass getDelegateXClass()
+ {
+ return ( XClass ) super.getDelegate();
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/DeclaredTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/InterfaceTypeImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/InterfaceTypeImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/InterfaceTypeImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/InterfaceTypeImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,38 @@
+/*
+ * 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.type;
+
+import
org.apache.beehive.netui.compiler.typesystem.declaration.InterfaceDeclaration;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.WrapperFactory;
+import org.apache.beehive.netui.compiler.typesystem.type.InterfaceType;
+import xjavadoc.XClass;
+
+public class InterfaceTypeImpl
+ extends DeclaredTypeImpl
+ implements InterfaceType
+{
+ public InterfaceTypeImpl( XClass delegate )
+ {
+ super( delegate );
+ }
+
+ public InterfaceDeclaration getInterfaceTypeDeclaration()
+ {
+ return WrapperFactory.get().getInterfaceDeclaration(
getDelegateXClass() );
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/InterfaceTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/PrimitiveTypeImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/PrimitiveTypeImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/PrimitiveTypeImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/PrimitiveTypeImpl.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.type;
+
+import org.apache.beehive.netui.compiler.typesystem.type.PrimitiveType;
+
+import java.util.HashMap;
+
+import xjavadoc.XClass;
+
+public class PrimitiveTypeImpl
+ extends TypeMirrorImpl
+ implements PrimitiveType
+{
+ private static final HashMap PRIMITIVE_TYPES = new HashMap();
+
+ static
+ {
+ PRIMITIVE_TYPES.put( "boolean", Kind.BOOLEAN );
+ PRIMITIVE_TYPES.put( "byte", Kind.BYTE );
+ PRIMITIVE_TYPES.put( "short", Kind.SHORT );
+ PRIMITIVE_TYPES.put( "int", Kind.INT );
+ PRIMITIVE_TYPES.put( "long", Kind.LONG );
+ PRIMITIVE_TYPES.put( "char", Kind.CHAR );
+ PRIMITIVE_TYPES.put( "float", Kind.FLOAT );
+ PRIMITIVE_TYPES.put( "double", Kind.DOUBLE );
+ }
+
+ private Kind _kind;
+
+ public PrimitiveTypeImpl( XClass delegate )
+ {
+ super( delegate );
+ _kind = ( Kind ) PRIMITIVE_TYPES.get( delegate.getName() );
+ assert _kind != null : "unexpected type " + delegate.getName();
+ }
+
+ public Kind getKind()
+ {
+ return _kind;
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/PrimitiveTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ReferenceTypeImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ReferenceTypeImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ReferenceTypeImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ReferenceTypeImpl.java
Tue Mar 15 23:14:32 2005
@@ -0,0 +1,30 @@
+/*
+ * 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.type;
+
+import org.apache.beehive.netui.compiler.typesystem.type.ReferenceType;
+
+public class ReferenceTypeImpl
+ extends TypeMirrorImpl
+ implements ReferenceType
+{
+ public ReferenceTypeImpl( Object delegate )
+ {
+ super( delegate );
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/ReferenceTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeMirrorImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeMirrorImpl.java?view=auto&rev=157713
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeMirrorImpl.java
(added)
+++
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeMirrorImpl.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.type;
+
+import org.apache.beehive.netui.compiler.typesystem.type.TypeMirror;
+import
org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.DelegatingImpl;
+
+public class TypeMirrorImpl
+ extends DelegatingImpl
+ implements TypeMirror
+{
+ public TypeMirrorImpl( Object delegate )
+ {
+ super( delegate );
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/TypeMirrorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native