java.lang.ClassLoader.definePackage()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(192)

本文整理了Java中java.lang.ClassLoader.definePackage()方法的一些代码示例,展示了ClassLoader.definePackage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassLoader.definePackage()方法的具体详情如下:
包路径:java.lang.ClassLoader
类名称:ClassLoader
方法名:definePackage

ClassLoader.definePackage介绍

[英]Defines and returns a new Package using the specified information. If sealBase is null, the package is left unsealed. Otherwise, the package is sealed using this URL.
[中]使用指定的信息定义并返回新包。如果sealBase为null,则该包保持未密封状态。否则,将使用此URL密封包。

代码示例

代码示例来源:origin: Silverpeas/Silverpeas-Core

@Override
protected Package definePackage(String name, String specTitle, String specVersion,
  String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase)
  throws IllegalArgumentException {
 return super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion,
   implVendor, sealBase);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-bootstrap

/** This is here just for locking serialization purposes.
 * Delegates to super.definePackage with proper locking.
 * Also tracks the package in our private cache, since
 * getPackageFast(...,...,false) will not call super.getPackage.
 */
@Override
protected Package definePackage(String name, String specTitle,
      String specVersion, String specVendor, String implTitle,
  String implVersion, String implVendor, URL sealBase )
  throws IllegalArgumentException {
  synchronized (packages) {
    Package pkg = super.definePackage(name, specTitle, specVersion, specVendor, implTitle,
      implVersion, implVendor, sealBase);
    packages.put(name, pkg);
    return pkg;
  }
}

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Implementation
  @Override
  protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException {
    return super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase);
  }
}

代码示例来源:origin: stackoverflow.com

definePackage("javax.swing","","","","","","",new URL("file://junk.class"));

代码示例来源:origin: org.jboss.forge/jboss-modules

/**
 * Defines a package by name in this <tt>ConcurrentClassLoader</tt>.  If the package was already defined, the
 * existing package is returned instead.
 *
 * @param name the package name
 * @param specTitle the specification title
 * @param specVersion the specification version
 * @param specVendor the specification vendor
 * @param implTitle the implementation title
 * @param implVersion the implementation version
 * @param implVendor the implementation vendor
 * @param sealBase if not {@code null}, then this package is sealed with respect to the given code source URL
 *
 * @return the newly defined package, or the existing one if one was already defined
 */
protected Package definePackage(final String name, final String specTitle, final String specVersion, final String specVendor, final String implTitle, final String implVersion, final String implVendor, final URL sealBase) throws IllegalArgumentException {
  ThreadLocal<Boolean> suppressor = GET_PACKAGE_SUPPRESSOR;
  suppressor.set(Boolean.TRUE);
  try {
    Package existing = packages.get(name);
    if (existing != null) {
      return existing;
    }
    Package pkg = super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase);
    existing = packages.putIfAbsent(name, pkg);
    return existing != null ? existing : pkg;
  } finally {
    suppressor.remove();
  }
}

代码示例来源:origin: ottogroup/SPQR

if(super.getPackage(packageName) == null) {
  super.definePackage(packageName, null, null, null, null, null, null, null);

相关文章