Package aQute.bnd.osgi
Class Clazz
- java.lang.Object
-
- aQute.bnd.osgi.Clazz
-
public class Clazz extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classClazz.AssocclassClazz.ClassConstantclassClazz.DefclassClazz.FieldDefstatic classClazz.JAVAclassClazz.MethodDefstatic classClazz.QUERYclassClazz.TypeDef
-
Field Summary
Fields Modifier and Type Field Description static java.util.EnumSet<Clazz.QUERY>HAS_ARGUMENTstatic java.util.Comparator<Clazz>NAME_COMPARATOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAbsolutePath()intgetAccess()java.util.Set<Descriptors.PackageRef>getAPIUses()Descriptors.TypeRefgetClassName()java.lang.StringgetClassSignature()java.util.Map<java.lang.String,java.lang.Object>getDefaults()Clazz.TypeDefgetExtends(Descriptors.TypeRef type)Clazz.JAVAgetFormat()java.lang.StringgetFQN()Clazz.TypeDefgetImplements(Descriptors.TypeRef type)Descriptors.TypeRef[]getInterfaces()Clazz.MethodDefgetMethodDef(int access, java.lang.String name, java.lang.String descriptor)To provide an enclosing instancejava.util.Set<Descriptors.PackageRef>getReferred()java.lang.StringgetSourceFile()Descriptors.TypeRefgetSuper()booleanhasPublicNoArgsConstructor()booleanis(Clazz.QUERY query, Instruction instr, Analyzer analyzer)booleanisAbstract()booleanisAnnotation()booleanisDeprecated()booleanisEnum()booleanisFinal()booleanisInterface()booleanisModule()booleanisProtected()booleanisPublic()booleanisSynthetic()static java.lang.StringobjectDescriptorToFQN(java.lang.String string)java.util.Set<Descriptors.TypeRef>parseClassFile()java.util.Set<Descriptors.TypeRef>parseClassFile(java.io.InputStream in)java.util.Set<Descriptors.TypeRef>parseClassFile(java.io.InputStream in, ClassDataCollector cd)java.util.Set<Descriptors.TypeRef>parseClassFileWithCollector(ClassDataCollector cd)voidparseDescriptor(java.lang.String descriptor, int modifiers)This method parses a descriptor and adds the package of the descriptor to the referenced packages.voidreset().class construct for different compilers sun 1.1 Detect static variable class$com$acme$MyClass 1.2 " 1.3 " 1.4 " 1.5 ldc_w (class) 1.6 " eclipse 1.1 class$0, ldc (string), invokestatic Class.forName 1.2 " 1.3 " 1.5 ldc (class) 1.6 " 1.5 and later is not an issue, sun pre 1.5 is easy to detect the static variable that decodes the class name.voidsetDeprecated(boolean b)voidsetInnerAccess(int access)java.lang.StringtoString()static java.lang.StringunCamel(java.lang.String id)
-
-
-
Field Detail
-
HAS_ARGUMENT
public static final java.util.EnumSet<Clazz.QUERY> HAS_ARGUMENT
-
NAME_COMPARATOR
public static final java.util.Comparator<Clazz> NAME_COMPARATOR
-
-
Method Detail
-
parseClassFile
public java.util.Set<Descriptors.TypeRef> parseClassFile() throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseClassFile
public java.util.Set<Descriptors.TypeRef> parseClassFile(java.io.InputStream in) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseClassFileWithCollector
public java.util.Set<Descriptors.TypeRef> parseClassFileWithCollector(ClassDataCollector cd) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseClassFile
public java.util.Set<Descriptors.TypeRef> parseClassFile(java.io.InputStream in, ClassDataCollector cd) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseDescriptor
public void parseDescriptor(java.lang.String descriptor, int modifiers)This method parses a descriptor and adds the package of the descriptor to the referenced packages. The syntax of the descriptor is:descriptor ::= ( '(' reference * ')' )? reference reference ::= 'L' classname ( '<' references '>' )? ';' | 'B' | 'Z' | ... | '+' | '-' | '['This methods uses heavy recursion to parse the descriptor and a roving pointer to limit the creation of string objects.- Parameters:
descriptor- The to be parsed descriptormodifiers-
-
getReferred
public java.util.Set<Descriptors.PackageRef> getReferred()
-
getAbsolutePath
public java.lang.String getAbsolutePath()
-
getSourceFile
public java.lang.String getSourceFile()
-
reset
public void reset()
.class construct for different compilers sun 1.1 Detect static variable class$com$acme$MyClass 1.2 " 1.3 " 1.4 " 1.5 ldc_w (class) 1.6 " eclipse 1.1 class$0, ldc (string), invokestatic Class.forName 1.2 " 1.3 " 1.5 ldc (class) 1.6 " 1.5 and later is not an issue, sun pre 1.5 is easy to detect the static variable that decodes the class name. For eclipse, the class$0 gives away we have a reference encoded in a string. compilerversions/compilerversions.jar contains test versions of all versions/compilers.
-
is
public boolean is(Clazz.QUERY query, Instruction instr, Analyzer analyzer) throws java.lang.Exception
- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isPublic
public boolean isPublic()
-
isProtected
public boolean isProtected()
-
isEnum
public boolean isEnum()
-
isSynthetic
public boolean isSynthetic()
-
isModule
public boolean isModule()
-
getFormat
public Clazz.JAVA getFormat()
-
objectDescriptorToFQN
public static java.lang.String objectDescriptorToFQN(java.lang.String string)
-
unCamel
public static java.lang.String unCamel(java.lang.String id)
-
isInterface
public boolean isInterface()
-
isAbstract
public boolean isAbstract()
-
hasPublicNoArgsConstructor
public boolean hasPublicNoArgsConstructor()
-
getAccess
public int getAccess()
-
getClassName
public Descriptors.TypeRef getClassName()
-
getMethodDef
public Clazz.MethodDef getMethodDef(int access, java.lang.String name, java.lang.String descriptor)
To provide an enclosing instance- Parameters:
access-name-descriptor-
-
getSuper
public Descriptors.TypeRef getSuper()
-
getFQN
public java.lang.String getFQN()
-
getInterfaces
public Descriptors.TypeRef[] getInterfaces()
-
setInnerAccess
public void setInnerAccess(int access)
-
isFinal
public boolean isFinal()
-
setDeprecated
public void setDeprecated(boolean b)
-
isDeprecated
public boolean isDeprecated()
-
isAnnotation
public boolean isAnnotation()
-
getAPIUses
public java.util.Set<Descriptors.PackageRef> getAPIUses()
-
getExtends
public Clazz.TypeDef getExtends(Descriptors.TypeRef type)
-
getImplements
public Clazz.TypeDef getImplements(Descriptors.TypeRef type)
-
getClassSignature
public java.lang.String getClassSignature()
-
getDefaults
public java.util.Map<java.lang.String,java.lang.Object> getDefaults() throws java.lang.Exception- Throws:
java.lang.Exception
-
-