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 class
Clazz.Assoc
class
Clazz.ClassConstant
class
Clazz.Def
class
Clazz.FieldDef
static class
Clazz.JAVA
class
Clazz.MethodDef
static class
Clazz.QUERY
class
Clazz.TypeDef
-
Field Summary
Fields Modifier and Type Field Description static java.util.EnumSet<Clazz.QUERY>
HAS_ARGUMENT
static java.util.Comparator<Clazz>
NAME_COMPARATOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAbsolutePath()
int
getAccess()
java.util.Set<Descriptors.PackageRef>
getAPIUses()
Descriptors.TypeRef
getClassName()
java.lang.String
getClassSignature()
java.util.Map<java.lang.String,java.lang.Object>
getDefaults()
Clazz.TypeDef
getExtends(Descriptors.TypeRef type)
Clazz.JAVA
getFormat()
java.lang.String
getFQN()
Clazz.TypeDef
getImplements(Descriptors.TypeRef type)
Descriptors.TypeRef[]
getInterfaces()
Clazz.MethodDef
getMethodDef(int access, java.lang.String name, java.lang.String descriptor)
To provide an enclosing instancejava.util.Set<Descriptors.PackageRef>
getReferred()
java.lang.String
getSourceFile()
Descriptors.TypeRef
getSuper()
boolean
hasPublicNoArgsConstructor()
boolean
is(Clazz.QUERY query, Instruction instr, Analyzer analyzer)
boolean
isAbstract()
boolean
isAnnotation()
boolean
isDeprecated()
boolean
isEnum()
boolean
isFinal()
boolean
isInterface()
boolean
isModule()
boolean
isProtected()
boolean
isPublic()
boolean
isSynthetic()
static java.lang.String
objectDescriptorToFQN(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)
void
parseDescriptor(java.lang.String descriptor, int modifiers)
This method parses a descriptor and adds the package of the descriptor to the referenced packages.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.void
setDeprecated(boolean b)
void
setInnerAccess(int access)
java.lang.String
toString()
static java.lang.String
unCamel(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:
toString
in 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
-
-