Package aQute.bnd.osgi
Class Descriptors
java.lang.Object
aQute.bnd.osgi.Descriptors
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
static class
static interface
-
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.static aQute.bnd.result.Result<String[]>
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
aQute.bnd.signatures.ClassSignature
getClassSignature
(String signature) getDescriptor
(String descriptor) aQute.bnd.signatures.FieldSignature
getFieldSignature
(String signature) aQute.bnd.signatures.MethodSignature
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
-
Constructor Details
-
Descriptors
public Descriptors()
-
-
Method Details
-
getTypeRef
-
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]
-