本文整理了Java中java.lang.ClassLoader.getPackage()
方法的一些代码示例,展示了ClassLoader.getPackage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassLoader.getPackage()
方法的具体详情如下:
包路径:java.lang.ClassLoader
类名称:ClassLoader
方法名:getPackage
[英]Returns the package with the specified name. Package information is searched in this class loader.
[中]返回具有指定名称的包。在此类加载器中搜索包信息。
代码示例来源:origin: hawtio/hawtio
@Override
public Package getPackage(String name) {
return super.getPackage(name);
}
}
代码示例来源:origin: robovm/robovm
/**
* Returns the {@code Package} of which the class represented by this
* {@code Class} is a member. Returns {@code null} if no {@code Package}
* object was created by the class loader of the class.
*/
public Package getPackage() {
// TODO This might be a hack, but the VM doesn't have the necessary info.
ClassLoader loader = getClassLoader();
if (loader != null) {
String name = getName();
int dot = name.lastIndexOf('.');
return (dot != -1 ? loader.getPackage(name.substring(0, dot)) : null);
}
return null;
}
代码示例来源:origin: robovm/robovm
/**
* Attempts to locate the requested package in the caller's class loader. If
* no package information can be located, {@code null} is returned.
*
* @param packageName
* the name of the package to find.
* @return the requested package, or {@code null}.
* @see ClassLoader#getPackage(java.lang.String)
*/
public static Package getPackage(String packageName) {
ClassLoader classloader = VMStack.getCallingClassLoader();
if (classloader == null) {
classloader = ClassLoader.getSystemClassLoader();
}
return classloader.getPackage(packageName);
}
代码示例来源:origin: robovm/robovm
if (name != null && !name.isEmpty()) {
synchronized(this) {
Package pack = super.getPackage(name);
代码示例来源:origin: mulesoft/mule
@Override
protected Package getPackage(String name) {
return filter.exportsPackage(name) ? super.getPackage(name) : null;
}
代码示例来源:origin: org.jboss.javassist/com.springsource.javassist
protected Package getPackage(String name) {
return super.getPackage(name);
}
/*
代码示例来源:origin: io.fabric8.forge/introspection
@Override
public Package getPackage(String name) {
return super.getPackage(name);
}
}
代码示例来源:origin: io.hawt/hawtio-util
@Override
public Package getPackage(String name) {
return super.getPackage(name);
}
}
代码示例来源:origin: Silverpeas/Silverpeas-Core
@Override
protected Package getPackage(String name) {
return super.getPackage(name);
}
代码示例来源:origin: org.nuxeo.ecm.webengine/nuxeo-webengine-core
@Override
protected Package getPackage(String name) {
return super.getPackage(name);
}
代码示例来源:origin: org.jboss/javassist
protected Package getPackage(String name) {
return super.getPackage(name);
}
/*
代码示例来源:origin: teatrove/teatrove
public Package getPackage(String name) {
return super.getPackage(name);
}
}
代码示例来源:origin: caskdata/cdap
@Override
protected Package getPackage(String name) {
if (!predicate.apply(name)) {
return null;
}
return super.getPackage(name);
}
代码示例来源:origin: co.cask.cdap/cdap-common
@Override
protected Package getPackage(String name) {
if (!predicate.apply(name)) {
return null;
}
return super.getPackage(name);
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Returns the {@code Package} of which the class represented by this
* {@code Class} is a member. Returns {@code null} if no {@code Package}
* object was created by the class loader of the class.
*/
public Package getPackage() {
// TODO This might be a hack, but the VM doesn't have the necessary info.
ClassLoader loader = getClassLoader();
if (loader != null) {
String name = getName();
int dot = name.lastIndexOf('.');
return (dot != -1 ? loader.getPackage(name.substring(0, dot)) : null);
}
return null;
}
代码示例来源:origin: caskdata/cdap
@Override
protected Package getPackage(String name) {
// Replace all '/' with '.' since Java allow both names like "java/lang" or "java.lang" as the name to lookup
return (filter.acceptPackage(name.replace('/', '.'))) ? super.getPackage(name) : null;
}
代码示例来源:origin: org.gradle/gradle-tooling-api
@Override
protected Package getPackage(String name) {
Package p = super.getPackage(name);
if (p == null || !allowed(p)) {
return null;
}
return p;
}
代码示例来源:origin: co.cask.cdap/cdap-common
@Override
protected Package getPackage(String name) {
// Replace all '/' with '.' since Java allow both names like "java/lang" or "java.lang" as the name to lookup
return (filter.acceptPackage(name.replace('/', '.'))) ? super.getPackage(name) : null;
}
代码示例来源:origin: org.gradle/gradle-base-services
@Override
protected Package getPackage(String name) {
Package p = super.getPackage(name);
if (p == null || !allowed(p)) {
return null;
}
return p;
}
代码示例来源:origin: org.jboss.forge/jboss-modules
/**
* Perform the actual work to load a package which is visible to this class loader. By default, uses a simple
* parent-first delegation strategy.
*
* @param name the package name
* @return the package, or {@code null} if no such package is visible to this class loader
*/
protected Package getPackageByName(final String name) {
final Package parentPackage = super.getPackage(name);
return parentPackage == null ? findLoadedPackage(name) : parentPackage;
}
内容来源于网络,如有侵权,请联系作者删除!