Example usage for java.lang Class getPackage

List of usage examples for java.lang Class getPackage

Introduction

In this page you can find the example usage for java.lang Class getPackage.

Prototype

public Package getPackage() 

Source Link

Document

Gets the package of this class.

Usage

From source file:edu.american.student.stonewall.util.Deployer.java

private static String getPath(Class<? extends Page> p) {
    Package pkg = p.getPackage();
    System.out.println(pkg.toString());
    return pkg.toString().replace("root", "").replace(".", File.separator).replace("package", "").trim();
}

From source file:org.codehaus.mojo.hibernate3.processor.ProcessorUtil.java

public static String insertImportIntoClassDefinition(Class<?> clzz, String body) {
    return insertImportIntoClassDefinition(clzz.getPackage().getName() + ".*", body);
}

From source file:org.ops4j.gaderian.impl.MessageFormatter.java

private static String getResourceBundleName(Class referenceClass, String name) {
    String packageName = null;/*from  ww w .  j a v  a2 s  . co m*/
    if (referenceClass.getPackage() != null) {
        packageName = referenceClass.getPackage().getName();
    } else {
        final int lastDotIndex = referenceClass.getName().lastIndexOf('.');
        packageName = (lastDotIndex == -1 ? "" : referenceClass.getName().substring(0, lastDotIndex));

    }
    return packageName.equals("") ? name : packageName + "." + name;
}

From source file:nl.denhaag.tw.util.Util.java

private static String getImplementationTitle(Class<?> clazz, String defaultString) {
    String title = clazz.getPackage().getImplementationTitle();
    if (StringUtils.isBlank(title)) {
        title = defaultString;/*from w ww  .j  ava2 s.  c o  m*/
    }
    return title;
}

From source file:nl.denhaag.tw.util.Util.java

private static String getImplementationVendor(Class<?> clazz, String defaultString) {
    String vendor = clazz.getPackage().getImplementationVendor();
    if (StringUtils.isBlank(vendor)) {
        vendor = defaultString;//from  ww  w. j  a  v  a2s. c  o m
    }
    return vendor;
}

From source file:org.drombler.commons.client.util.ResourceBundleUtils.java

public static String getPackageResourceStringPrefixed(Class<?> type, String resourceKey) {
    return getPackageResourceStringPrefixed(type.getPackage().getName(), resourceKey, type.getClassLoader());
}

From source file:nl.denhaag.tw.util.Util.java

private static String getImplementationVersion(Class<?> clazz, String defaultString) {
    String version = clazz.getPackage().getImplementationVersion();
    if (StringUtils.isBlank(version)) {
        version = defaultString;//from   w  w  w .j av  a  2s  . c om
    }
    return version;
}

From source file:uk.co.modularaudio.util.hibernate.ReflectionUtils.java

public static String getClassPackageAsPath(final Object o) {
    final Class<?> theObject = o.getClass();
    final Package thePackage = theObject.getPackage();
    final String packageAsString = thePackage.toString();
    final String tmpVal = packageAsString.replaceAll("package\\s", "");
    final String retVal = tmpVal.replaceAll("\\.", "/");
    return retVal;
}

From source file:no.digipost.api.xml.Marshalling.java

private static String packageName(final Class<?> jaxbClass) {
    return jaxbClass.getPackage().getName();
}

From source file:org.drombler.commons.client.util.ResourceBundleUtils.java

public static String getClassResourceStringPrefixed(Class<?> type, String resourceKey) {
    return getResourceStringPrefixed(resourceKey, type.getPackage().getName(), type.getSimpleName(),
            type.getClassLoader());/* w  w  w. j ava 2 s  . com*/
}