Package aQute.bnd.osgi
Class Descriptors
java.lang.Object
aQute.bnd.osgi.Descriptors
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
class
static class
static interface
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Descriptors.TypeRef
(package private) static final Descriptors.TypeRef
(package private) static final Descriptors.TypeRef
private final Map<String,
ClassSignature> (package private) static final Descriptors.PackageRef
private final Map<String,
Descriptors.Descriptor> (package private) static final Descriptors.TypeRef
private final Map<String,
FieldSignature> (package private) static final Descriptors.TypeRef
(package private) static final Descriptors.TypeRef
(package private) static final Descriptors.TypeRef
private final Map<String,
MethodSignature> private final Map<String,
Descriptors.PackageRef> (package private) static final Descriptors.PackageRef
(package private) static final Descriptors.TypeRef
private final Map<String,
Descriptors.TypeRef> (package private) static final Descriptors.TypeRef
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
binaryClassToFQN
(String path) static String
binaryToFQN
(String binary) static String
binaryToSimple
(String resource) Java really screwed up in using different names for the binary path and the fqns.static String
classToPath
(String className) Converts the class name (without the package qualifier) into the corresponding binary name.private Descriptors.TypeRef
createTypeRef
(String binaryClassName) Return a 2 element array based on the fqn.static String
fqnClassToBinary
(String fqn) Converts the given fully-qualified top-level class name into the binary class path.static String
fqnToBinary
(String fqn) static String
getClassSignature
(String signature) getDescriptor
(String descriptor) getFieldSignature
(String signature) getMethodSignature
(String signature) static String
getPackage
(String binaryNameOrFqn) getPackageInfo
(Descriptors.PackageRef packageRef) getPackageRef
(String binaryPackName) static String
getShortName
(String fqn) Return the short name of a FQNgetTypeRef
(String binaryClassName) getTypeRefFromFQN
(String fqn) getTypeRefFromPath
(String path) static boolean
isBinaryClass
(String resource) static boolean
isClassName
(String fqn) Heuristic for a class name.static String
-
Field Details
-
typeRefCache
-
descriptorCache
-
packageRefCache
-
classSignatureCache
-
methodSignatureCache
-
fieldSignatureCache
-
DEFAULT_PACKAGE
-
PRIMITIVE_PACKAGE
-
VOID
-
BOOLEAN
-
BYTE
-
CHAR
-
SHORT
-
INTEGER
-
LONG
-
DOUBLE
-
FLOAT
-
-
Constructor Details
-
Descriptors
public Descriptors()
-
-
Method Details
-
getTypeRef
-
createTypeRef
-
getPackageInfo
-
getPackageRef
-
getDescriptor
-
getClassSignature
-
getMethodSignature
-
getFieldSignature
-
getShortName
Return the short name of a FQN -
binaryToFQN
-
binaryClassToFQN
-
fqnToBinary
-
fqnClassToBinary
Converts the given fully-qualified top-level class name into the binary class path. For example:my.pkg.And.Clazz
becomes:my/pkg/And$Clazz.class
This method uses
determine(String)
to split the class and package names, which is imperfect.- Parameters:
fqn
- the fully-qualified name to be converted.- Returns:
- The binary name corresponding to the fully-qualified name.
-
classToPath
Converts the class name (without the package qualifier) into the corresponding binary name. For example:my.pkg.and.Clazz
becomes:my$pkg$and$Clazz.class
As you can see, this method is not smart about distinguishing between package and class nesting - it always converts the . into a $.- Parameters:
className
- the name of the class to be converted.- Returns:
- The binary name corresponding to the class name.
-
getPackage
-
fqnToPath
-
getTypeRefFromFQN
-
getTypeRefFromPath
-
pathToFqn
-
isBinaryClass
-
binaryToSimple
Java really screwed up in using different names for the binary path and the fqns. This calculates the simple name of a potentially nested class.- Parameters:
resource
- ( segment '/')+ (name '$')* name '.class'- Returns:
- the last name
-
isClassName
Heuristic for a class name. We assume a segment with- Parameters:
fqn
- can be a class name, nested class, or simple name- Returns:
- true if the last segment starts with an upper case
-
determine
Return a 2 element array based on the fqn. The first element is the package name, the second is the class name. Each can be absent, but not both. The class name can be a nested class (will contain a '.' then)Because there is an inherent ambiguity between packages and nested classes, this method uses a heuristic that works most of the time: the start of the class name is considered to be the first element that begins with a capital letter. Hence "simple.Sample.Sumple" => ["simple", "Sample.Sumple" ] and not [ "simple.Sample", "Sumple" ].
- Parameters:
fqn
- a Java identifier name, either a simple class name, a qualified class name, or a package name- Returns:
- a Result with 2 element array with [package, class]
-