1 18 package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.declaration; 19 20 import org.apache.beehive.netui.compiler.JpfLanguageConstants; 21 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; 22 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeDeclaration; 23 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration; 24 import org.apache.beehive.netui.compiler.typesystem.declaration.FieldDeclaration; 25 import org.apache.beehive.netui.compiler.typesystem.declaration.MethodDeclaration; 26 import org.apache.beehive.netui.compiler.typesystem.declaration.Modifier; 27 import org.apache.beehive.netui.compiler.typesystem.declaration.PackageDeclaration; 28 import org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration; 29 import org.apache.beehive.netui.compiler.typesystem.type.InterfaceType; 30 import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition; 31 32 import java.util.HashMap ; 33 import java.util.Set ; 34 35 public class AnnotationTypeDeclarationImpl 36 implements AnnotationTypeDeclaration, JpfLanguageConstants 37 { 38 private String _annotationName; 39 private String _packageName; 40 private String _intermediateName; 41 private AnnotationTypeElementDeclaration[] _members; 42 private HashMap _membersByName; 43 44 public AnnotationTypeDeclarationImpl( String annotationName, String interfaceQualifier, 45 String packageName, AnnotationTypeElementDeclaration[] members ) 46 { 47 _annotationName = annotationName; 48 _intermediateName = interfaceQualifier != null ? interfaceQualifier + annotationName : annotationName; 49 _packageName = packageName; 50 _members = members; 51 52 _membersByName = new HashMap (); 53 for ( int i = 0; i < members.length; i++ ) 54 { 55 AnnotationTypeElementDeclaration member = members[i]; 56 _membersByName.put( member.getSimpleName(), member ); 57 } 58 } 59 60 public AnnotationTypeDeclarationImpl( AnnotationTypeDeclarationImpl source, String annotationName, 61 String interfaceQualifier ) 62 { 63 _annotationName = annotationName; 64 _intermediateName = interfaceQualifier != null ? interfaceQualifier + annotationName : annotationName; 65 _packageName = source._packageName; 66 _members = source._members; 67 _membersByName = source._membersByName; 68 } 69 70 public AnnotationTypeElementDeclaration[] getAnnotationMembers() 71 { 72 return _members; 73 } 74 75 public AnnotationTypeElementDeclaration getMember( String name ) 76 { 77 return ( AnnotationTypeElementDeclaration ) _membersByName.get( name ); 78 } 79 80 public PackageDeclaration getPackage() 81 { 82 assert false : "NYI"; 83 throw new UnsupportedOperationException ( "NYI" ); 84 } 85 86 public String getQualifiedName() 87 { 88 return _packageName + '.' + _intermediateName; 89 } 90 91 public InterfaceType[] getSuperinterfaces() 92 { 93 assert false : "NYI"; 94 throw new UnsupportedOperationException ( "NYI" ); 95 } 96 97 public FieldDeclaration[] getFields() 98 { 99 assert false : "NYI"; 100 throw new UnsupportedOperationException ( "NYI" ); 101 } 102 103 public MethodDeclaration[] getMethods() 104 { 105 assert false : "NYI"; 106 throw new UnsupportedOperationException ( "NYI" ); 107 } 108 109 public TypeDeclaration[] getNestedTypes() 110 { 111 assert false : "NYI"; 112 throw new UnsupportedOperationException ( "NYI" ); 113 } 114 115 public TypeDeclaration getDeclaringType() 116 { 117 assert false : "NYI"; 118 throw new UnsupportedOperationException ( "NYI" ); 119 } 120 121 public String getDocComment() 122 { 123 assert false : "NYI"; 124 throw new UnsupportedOperationException ( "NYI" ); 125 } 126 127 public AnnotationInstance[] getAnnotationInstances() 128 { 129 assert false : "NYI"; 130 throw new UnsupportedOperationException ( "NYI" ); 131 } 132 133 public Set getModifiers() 134 { 135 assert false : "NYI"; 136 throw new UnsupportedOperationException ( "NYI" ); 137 } 138 139 public String getSimpleName() 140 { 141 return _annotationName; 142 } 143 144 public String getIntermediateName() 145 { 146 return _intermediateName; 147 } 148 149 public SourcePosition getPosition() 150 { 151 assert false : "NYI"; 152 throw new UnsupportedOperationException ( "NYI" ); 153 } 154 155 public boolean hasModifier( Modifier modifier ) 156 { 157 assert false : "NYI"; 158 throw new UnsupportedOperationException ( "NYI" ); 159 } 160 161 public boolean equals( Object o ) 162 { 163 if ( o == null ) return false; 164 if ( o == this ) return true; 165 if ( ! ( o instanceof AnnotationTypeDeclarationImpl ) ) return false; 166 return getQualifiedName().equals( ( ( AnnotationTypeDeclarationImpl ) o ).getQualifiedName() ); 167 } 168 } 169 | Popular Tags |