本文整理了Java中aQute.bnd.osgi.Analyzer.getTypeRefFromFQN()
方法的一些代码示例,展示了Analyzer.getTypeRefFromFQN()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Analyzer.getTypeRefFromFQN()
方法的具体详情如下:
包路径:aQute.bnd.osgi.Analyzer
类名称:Analyzer
方法名:getTypeRefFromFQN
暂无
代码示例来源:origin: biz.aQute.bnd/bndlib
AnnotationHeaders(Analyzer analyzer) {
this.analyzer = analyzer;
//
// The analyser has its own domain of type refs, so we need to get our
// standard set to do fast comparisons
//
interesting.add(bundleLicenseRef = analyzer.getTypeRefFromFQN(BundleLicense.class.getName()));
interesting.add(requireCapabilityRef = analyzer.getTypeRefFromFQN(RequireCapability.class.getName()));
interesting.add(provideCapabilityRef = analyzer.getTypeRefFromFQN(ProvideCapability.class.getName()));
interesting.add(bundleCategoryRef = analyzer.getTypeRefFromFQN(BundleCategory.class.getName()));
interesting.add(bundleDocURLRef = analyzer.getTypeRefFromFQN(BundleDocURL.class.getName()));
interesting.add(bundleDeveloperRef = analyzer.getTypeRefFromFQN(BundleDevelopers.class.getName()));
interesting.add(bundleContributorRef = analyzer.getTypeRefFromFQN(BundleContributors.class.getName()));
interesting.add(bundleCopyrightRef = analyzer.getTypeRefFromFQN(BundleCopyright.class.getName()));
}
代码示例来源:origin: biz.aQute.bnd/bnd
AnnotationHeaders(Analyzer analyzer) {
this.analyzer = analyzer;
//
// The analyser has its own domain of type refs, so we need to get our
// standard set to do fast comparisons
//
interesting.add(bundleLicenseRef = analyzer.getTypeRefFromFQN(BundleLicense.class.getName()));
interesting.add(requireCapabilityRef = analyzer.getTypeRefFromFQN(RequireCapability.class.getName()));
interesting.add(provideCapabilityRef = analyzer.getTypeRefFromFQN(ProvideCapability.class.getName()));
interesting.add(bundleCategoryRef = analyzer.getTypeRefFromFQN(BundleCategory.class.getName()));
interesting.add(bundleDocURLRef = analyzer.getTypeRefFromFQN(BundleDocURL.class.getName()));
interesting.add(bundleDeveloperRef = analyzer.getTypeRefFromFQN(BundleDevelopers.class.getName()));
interesting.add(bundleContributorRef = analyzer.getTypeRefFromFQN(BundleContributors.class.getName()));
interesting.add(bundleCopyrightRef = analyzer.getTypeRefFromFQN(BundleCopyright.class.getName()));
}
代码示例来源:origin: biz.aQute.bnd/bndlib
private boolean isProvider(TypeRef t) throws Exception {
Clazz c = findClass(t);
if (c == null)
return false;
if (c.annotations == null)
return false;
TypeRef pt = getTypeRefFromFQN(ProviderType.class.getName());
TypeRef r6pt = getTypeRefFromFQN("org.osgi.annotation.versioning.ProviderType");
boolean result = c.annotations.contains(pt) || c.annotations.contains(r6pt);
return result;
}
代码示例来源:origin: biz.aQute.bnd/bnd
private boolean isProvider(TypeRef t) throws Exception {
Clazz c = findClass(t);
if (c == null)
return false;
if (c.annotations == null)
return false;
TypeRef pt = getTypeRefFromFQN(ProviderType.class.getName());
TypeRef r6pt = getTypeRefFromFQN("org.osgi.annotation.versioning.ProviderType");
boolean result = c.annotations.contains(pt) || c.annotations.contains(r6pt);
return result;
}
代码示例来源:origin: biz.aQute/bndlib
private boolean isProvider(TypeRef t) throws Exception {
Clazz c = findClass(t);
if (c == null)
return false;
if (c.annotations == null)
return false;
TypeRef pt = getTypeRefFromFQN(ProviderType.class.getName());
boolean result = c.annotations.contains(pt);
return result;
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
public boolean assignable(String annoService, String inferredService) {
if (annoService == null || annoService.isEmpty() || inferredService == null || inferredService.isEmpty()
|| Object.class.getName()
.equals(inferredService))
return true;
try {
Clazz annoServiceClazz = findClass(getTypeRefFromFQN(annoService));
Clazz inferredServiceClazz = findClass(getTypeRefFromFQN(inferredService));
return assignable(annoServiceClazz, inferredServiceClazz);
} catch (Exception e) {}
// we couldn't determine
return true;
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
public boolean assignable(String annoService, String inferredService) {
if (annoService == null || annoService.isEmpty() || inferredService == null || inferredService.isEmpty()
|| Object.class.getName()
.equals(inferredService))
return true;
try {
Clazz annoServiceClazz = findClass(getTypeRefFromFQN(annoService));
Clazz inferredServiceClazz = findClass(getTypeRefFromFQN(inferredService));
return assignable(annoServiceClazz, inferredServiceClazz);
} catch (Exception e) {}
// we couldn't determine
return true;
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
/**
* @param cd
* @param provides
*/
void provide(ComponentDef cd, String provides, String impl) {
if (provides != null) {
StringTokenizer st = new StringTokenizer(provides, ",");
List<TypeRef> provide = new ArrayList<>();
while (st.hasMoreTokens()) {
String interfaceName = st.nextToken();
TypeRef ref = analyzer.getTypeRefFromFQN(interfaceName);
provide.add(ref);
analyzer.referTo(ref);
// TODO verifies the impl. class extends or implements the
// interface
}
cd.service = provide.toArray(new TypeRef[0]);
}
}
代码示例来源:origin: biz.aQute/bndlib
/**
* @param cd
* @param provides
*/
void provide(ComponentDef cd, String provides, String impl) {
if (provides != null) {
StringTokenizer st = new StringTokenizer(provides, ",");
List<TypeRef> provide = new ArrayList<TypeRef>();
while (st.hasMoreTokens()) {
String interfaceName = st.nextToken();
TypeRef ref = analyzer.getTypeRefFromFQN(interfaceName);
provide.add(ref);
analyzer.referTo(ref);
// TODO verifies the impl. class extends or implements the
// interface
}
cd.service = provide.toArray(new TypeRef[provide.size()]);
}
}
代码示例来源:origin: biz.aQute.bnd/bndlib
/**
* @param cd
* @param provides
*/
void provide(ComponentDef cd, String provides, String impl) {
if (provides != null) {
StringTokenizer st = new StringTokenizer(provides, ",");
List<TypeRef> provide = new ArrayList<TypeRef>();
while (st.hasMoreTokens()) {
String interfaceName = st.nextToken();
TypeRef ref = analyzer.getTypeRefFromFQN(interfaceName);
provide.add(ref);
analyzer.referTo(ref);
// TODO verifies the impl. class extends or implements the
// interface
}
cd.service = provide.toArray(new TypeRef[provide.size()]);
}
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
/**
* @param cd
* @param provides
*/
void provide(ComponentDef cd, String provides, String impl) {
if (provides != null) {
StringTokenizer st = new StringTokenizer(provides, ",");
List<TypeRef> provide = new ArrayList<>();
while (st.hasMoreTokens()) {
String interfaceName = st.nextToken();
TypeRef ref = analyzer.getTypeRefFromFQN(interfaceName);
provide.add(ref);
analyzer.referTo(ref);
// TODO verifies the impl. class extends or implements the
// interface
}
cd.service = provide.toArray(new TypeRef[0]);
}
}
代码示例来源:origin: biz.aQute.bnd/bnd
/**
* @param cd
* @param provides
*/
void provide(ComponentDef cd, String provides, String impl) {
if (provides != null) {
StringTokenizer st = new StringTokenizer(provides, ",");
List<TypeRef> provide = new ArrayList<TypeRef>();
while (st.hasMoreTokens()) {
String interfaceName = st.nextToken();
TypeRef ref = analyzer.getTypeRefFromFQN(interfaceName);
provide.add(ref);
analyzer.referTo(ref);
// TODO verifies the impl. class extends or implements the
// interface
}
cd.service = provide.toArray(new TypeRef[provide.size()]);
}
}
代码示例来源:origin: biz.aQute/bndlib
private void createComponentResource(Map<String,Map<String,String>> components, String name,
Map<String,String> info) throws Exception {
// We can override the name in the parameters
if (info.containsKey(COMPONENT_NAME))
name = info.get(COMPONENT_NAME);
// Assume the impl==name, but allow override
String impl = name;
if (info.containsKey(COMPONENT_IMPLEMENTATION))
impl = info.get(COMPONENT_IMPLEMENTATION);
TypeRef implRef = analyzer.getTypeRefFromFQN(impl);
// Check if such a class exists
analyzer.referTo(implRef);
boolean designate = designate(name, info.get(COMPONENT_DESIGNATE), false)
|| designate(name, info.get(COMPONENT_DESIGNATEFACTORY), true);
// If we had a designate, we want a default configuration policy of
// require.
if (designate && info.get(COMPONENT_CONFIGURATION_POLICY) == null)
info.put(COMPONENT_CONFIGURATION_POLICY, "require");
// We have a definition, so make an XML resources
Resource resource = createComponentResource(name, impl, info);
analyzer.getJar().putResource("OSGI-INF/" + name + ".xml", resource);
components.put("OSGI-INF/" + name + ".xml", EMPTY);
}
代码示例来源:origin: biz.aQute.bnd/bnd
private void createComponentResource(Map<String,Map<String,String>> components, String name,
Map<String,String> info) throws Exception {
// We can override the name in the parameters
if (info.containsKey(COMPONENT_NAME))
name = info.get(COMPONENT_NAME);
// Assume the impl==name, but allow override
String impl = name;
if (info.containsKey(COMPONENT_IMPLEMENTATION))
impl = info.get(COMPONENT_IMPLEMENTATION);
TypeRef implRef = analyzer.getTypeRefFromFQN(impl);
// Check if such a class exists
analyzer.referTo(implRef);
boolean designate = designate(name, info.get(COMPONENT_DESIGNATE), false)
|| designate(name, info.get(COMPONENT_DESIGNATEFACTORY), true);
// If we had a designate, we want a default configuration policy of
// require.
if (designate && info.get(COMPONENT_CONFIGURATION_POLICY) == null)
info.put(COMPONENT_CONFIGURATION_POLICY, "require");
// We have a definition, so make an XML resources
Resource resource = createComponentResource(name, impl, info);
String pathSegment = analyzer.validResourcePath(name, "Invalid component name");
analyzer.getJar().putResource("OSGI-INF/" + pathSegment + ".xml", resource);
components.put("OSGI-INF/" + pathSegment + ".xml", EMPTY);
}
代码示例来源:origin: biz.aQute/bndlib
private Element getLocalAPI() throws Exception {
List<Element> result = new ArrayList<Element>();
for (Map.Entry<PackageRef,List<Element>> entry : packages.entrySet()) {
List<Element> set = entry.getValue();
for (Iterator<Element> i = set.iterator(); i.hasNext();) {
if (notAccessible.contains(analyzer.getTypeRefFromFQN(i.next().getName())))
i.remove();
}
String version = exports.get(entry.getKey()).get(Constants.VERSION_ATTRIBUTE);
if (version != null) {
Version v = new Version(version);
set.add(new Element(Type.VERSION, v.getWithoutQualifier().toString(), null, IGNORED, IGNORED, null));
}
Element pd = new Element(Type.PACKAGE, entry.getKey().getFQN(), set, MINOR, MAJOR, null);
result.add(pd);
}
for (JAVA java : javas) {
result.add(new Element(CLASS_VERSION, java.toString(), null, Delta.CHANGED, Delta.CHANGED, null));
}
return new Element(Type.API, "<api>", result, CHANGED, CHANGED, null);
}
代码示例来源:origin: biz.aQute.bnd/bndlib
private Element getLocalAPI() throws Exception {
Set<Element> result = new HashSet<Element>();
for (Map.Entry<PackageRef,List<Element>> entry : packages.entrySet()) {
List<Element> set = entry.getValue();
for (Iterator<Element> i = set.iterator(); i.hasNext();) {
if (notAccessible.contains(analyzer.getTypeRefFromFQN(i.next().getName())))
i.remove();
}
String version = exports.get(entry.getKey()).get(Constants.VERSION_ATTRIBUTE);
if (version != null) {
Version v = new Version(version);
set.add(new Element(Type.VERSION, v.getWithoutQualifier().toString(), null, IGNORED, IGNORED, null));
}
Element pd = new Element(Type.PACKAGE, entry.getKey().getFQN(), set, MINOR, MAJOR, null);
result.add(pd);
}
for (JAVA java : javas) {
result.add(new Element(CLASS_VERSION, java.toString(), null, Delta.CHANGED, Delta.CHANGED, null));
}
return new Element(Type.API, "<api>", result, CHANGED, CHANGED, null);
}
代码示例来源:origin: biz.aQute.bnd/bnd
private Element getLocalAPI() throws Exception {
Set<Element> result = new HashSet<Element>();
for (Map.Entry<PackageRef,List<Element>> entry : packages.entrySet()) {
List<Element> set = entry.getValue();
for (Iterator<Element> i = set.iterator(); i.hasNext();) {
if (notAccessible.contains(analyzer.getTypeRefFromFQN(i.next().getName())))
i.remove();
}
String version = exports.get(entry.getKey()).get(Constants.VERSION_ATTRIBUTE);
if (version != null) {
Version v = new Version(version);
set.add(new Element(Type.VERSION, v.getWithoutQualifier().toString(), null, IGNORED, IGNORED, null));
}
Element pd = new Element(Type.PACKAGE, entry.getKey().getFQN(), set, MINOR, MAJOR, null);
result.add(pd);
}
for (JAVA java : javas) {
result.add(new Element(CLASS_VERSION, java.toString(), null, Delta.CHANGED, Delta.CHANGED, null));
}
return new Element(Type.API, "<api>", result, CHANGED, CHANGED, null);
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
private Element getLocalAPI() throws Exception {
Set<Element> result = new HashSet<>();
for (Map.Entry<PackageRef, List<Element>> entry : packages.entrySet()) {
List<Element> set = entry.getValue();
set.removeIf(element -> notAccessible.contains(analyzer.getTypeRefFromFQN(element.getName())));
String version = exports.get(entry.getKey())
.get(Constants.VERSION_ATTRIBUTE);
if (version != null) {
Version v = new Version(version);
set.add(new Element(VERSION, v.toStringWithoutQualifier(), null, IGNORED, IGNORED, null));
}
Element pd = new Element(PACKAGE, entry.getKey()
.getFQN(), set, MINOR, MAJOR, null);
result.add(pd);
}
for (JAVA java : javas) {
result.add(new Element(CLASS_VERSION, java.toString(), null, CHANGED, CHANGED, null));
}
return new Element(API, "<api>", result, CHANGED, CHANGED, null);
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
private Element getLocalAPI() throws Exception {
Set<Element> result = new HashSet<>();
for (Map.Entry<PackageRef, List<Element>> entry : packages.entrySet()) {
List<Element> set = entry.getValue();
set.removeIf(element -> notAccessible.contains(analyzer.getTypeRefFromFQN(element.getName())));
String version = exports.get(entry.getKey())
.get(Constants.VERSION_ATTRIBUTE);
if (version != null) {
Version v = new Version(version);
set.add(new Element(VERSION, v.toStringWithoutQualifier(), null, IGNORED, IGNORED, null));
}
Element pd = new Element(PACKAGE, entry.getKey()
.getFQN(), set, MINOR, MAJOR, null);
result.add(pd);
}
for (JAVA java : javas) {
result.add(new Element(CLASS_VERSION, java.toString(), null, CHANGED, CHANGED, null));
}
return new Element(API, "<api>", result, CHANGED, CHANGED, null);
}
代码示例来源:origin: biz.aQute/bndlib
private void verifyActivator() throws Exception {
String bactivator = main.get("Bundle-Activator");
if (bactivator != null) {
TypeRef ref = analyzer.getTypeRefFromFQN(bactivator);
if (analyzer.getClassspace().containsKey(ref))
return;
PackageRef packageRef = ref.getPackageRef();
if (packageRef.isDefaultPackage())
error("The Bundle Activator is not in the bundle and it is in the default package ");
else if (!analyzer.isImported(packageRef)) {
error("Bundle-Activator not found on the bundle class path nor in imports: " + bactivator);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!