Example usage for java.lang Package getName

List of usage examples for java.lang Package getName

Introduction

In this page you can find the example usage for java.lang Package getName.

Prototype

public String getName() 

Source Link

Document

Return the name of this package.

Usage

From source file:com.virtualparadigm.packman.processor.JPackageManagerBU.java

private static Collection<Package> findInstalledPackages(String regex) {
    List<Package> installPackageList = new ArrayList<Package>();
    for (Package installPackage : JPackageManagerBU.findInstalledPackages()) {
        if (installPackage.getName().matches(regex)) {
            installPackageList.add(installPackage);
        }/*from   ww w . j  a v  a 2  s  .  c o  m*/
    }
    return installPackageList;
}

From source file:com.l2jfree.L2Config.java

protected static void initApplication(Package configPackage,
        Class<? extends ThreadPoolInitializer> threadPoolInitializerClass) {
    initApplication(configPackage.getName(), threadPoolInitializerClass, null);
}

From source file:cascading.util.Util.java

public static String captureDebugTrace(Class type) {
    StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();

    for (int i = 3; i < stackTrace.length; i++) {
        StackTraceElement stackTraceElement = stackTrace[i];

        Package aPackage = type.getPackage();

        if (aPackage != null && stackTraceElement.getClassName().startsWith(aPackage.getName()))
            continue;

        return stackTraceElement.toString();
    }//from  www .j  a v a 2  s. c o  m

    return null;
}

From source file:Main.java

/**
 * Extracts the package name from the given class object
 *//*  w w  w .  j  a v a 2s.c om*/
public static String getPackage(Class<?> cls) {
    // cls.getPackage() sometimes returns null, in which case fall back to string massaging.
    java.lang.Package pkg = cls.isArray() ? cls.getComponentType().getPackage() : cls.getPackage();
    if (pkg == null) {
        int dotPos;
        int dolPos = cls.getName().indexOf('$');
        if (dolPos > 0) {
            // we have nested classes, so adjust dotpos to before first $
            dotPos = cls.getName().substring(0, dolPos).lastIndexOf('.');
        } else {
            dotPos = cls.getName().lastIndexOf('.');
        }

        if (dotPos > 0) {
            return cls.getName().substring(0, dotPos);
        } else {
            // must be default package.
            return "";
        }
    } else {
        return pkg.getName();
    }
}

From source file:io.sloeber.core.managers.InternalPackageManager.java

public static IPath getPlatformInstallPath(String refVendor, String refArchitecture, String refVersion) {
    for (PackageIndex index : getPackageIndices()) {
        for (Package pkg : index.getPackages()) {
            if (refVendor.equalsIgnoreCase(pkg.getName())) {
                for (ArduinoPlatform curPlatform : pkg.getInstalledPlatforms()) {
                    if (refArchitecture.equalsIgnoreCase(curPlatform.getArchitecture())
                            && refVersion.equalsIgnoreCase(curPlatform.getVersion())) {
                        return new org.eclipse.core.runtime.Path(curPlatform.getInstallPath().toString());
                    }//from w  ww  .j  a v a2s  .c  om
                }
            }
        }
    }
    return null;
}

From source file:com.l2jfree.L2Config.java

protected static void initApplication(Package configPackage,
        Class<? extends ThreadPoolInitializer> threadPoolInitializerClass,
        Class<? extends DataSourceInitializer> dataSourceInitializerClass) {
    initApplication(configPackage.getName(), threadPoolInitializerClass, dataSourceInitializerClass);
}

From source file:org.topazproject.otm.metadata.AnnotationClassMetaFactory.java

private static String getName(Class<?> clazz) {
    String name = clazz.getName();
    Package p = clazz.getPackage();

    if (p != null)
        name = name.substring(p.getName().length() + 1);

    return name;//from www  . j  av a  2 s .com
}

From source file:wordnice.utils.JavaUtils.java

public static void filterPackages(Collection<Package> out, Collection<Package> in, String pref) {
    Iterator<Package> it = in.iterator();
    while (it.hasNext()) {
        Package cur = it.next();
        if (cur.getName().startsWith(pref)) {
            out.add(cur);/*w  w  w .j  ava  2s  .c  o  m*/
        }
    }
}

From source file:com.virtualparadigm.packman.processor.JPackageManager.java

private static void addInstalledPackage(Package installPackage) {
    installedPackageMap.put(installPackage.getName(), installPackage);
}

From source file:com.virtualparadigm.packman.processor.JPackageManager.java

private static Collection<Package> findInstalledPackages(String regex) {
    List<Package> installPackageList = new ArrayList<Package>();
    for (Package installPackage : JPackageManager.findInstalledPackages()) {
        if (installPackage.getName().matches(regex)) {
            installPackageList.add(installPackage);
        }/*  w ww. ja va 2s.com*/
    }
    return installPackageList;
}