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:Main.java

@SuppressWarnings("unchecked")
public static String classPackageAsResourcePath(Class clazz) {
    if (clazz == null || clazz.getPackage() == null)
        return "";
    else/*  w  w  w .j  av a  2  s.c om*/
        return clazz.getPackage().getName().replace('.', '/');
}

From source file:Main.java

public static boolean shouldBeExcluded(Class clazz) {
    String package_ = clazz.getPackage().getName();
    for (String i : EXCLUDED_OBJECT_PACKAGE_PREFIXES)
        if (package_.startsWith(i))
            return true;

    return false;
}

From source file:Main.java

private static String getNamespace(Class<?> aClass) {
    XmlSchema xmlSchema = aClass.getPackage().getAnnotation(XmlSchema.class);
    return xmlSchema.namespace();
}

From source file:Main.java

public static String getExpectedClassId(Class clazz) {
    return clazz.getSimpleName() + "." + clazz.getPackage().getName();
}

From source file:Main.java

private static JAXBContext getContext(Class<?> clazz) throws JAXBException {
    return JAXBContext.newInstance(clazz.getPackage().getName(), clazz.getClassLoader());
}

From source file:Main.java

public static boolean isInputMethodDefault(Context context, Class<?> imeClass) {
    final String targetImePackage = imeClass.getPackage().getName();
    final String targetImeClass = imeClass.getSimpleName();
    final String defaultImeId = Settings.Secure.getString(context.getContentResolver(),
            Settings.Secure.DEFAULT_INPUT_METHOD);

    return defaultImeId != null && defaultImeId.contains(targetImePackage)
            && defaultImeId.contains(targetImeClass);
}

From source file:Main.java

public static boolean isInputMethodEnabled(Context context, Class<?> imeClass) {
    final String targetImePackage = imeClass.getPackage().getName();
    final String targetImeClass = imeClass.getSimpleName();
    final String enabledImeIds = Settings.Secure.getString(context.getContentResolver(),
            Settings.Secure.ENABLED_INPUT_METHODS);

    return enabledImeIds != null && enabledImeIds.contains(targetImePackage)
            && enabledImeIds.contains(targetImeClass);
}

From source file:Main.java

public static <T> String getNamespaceUriFromJaxbClass(Class<T> jaxbClass) {
    String nsURI = "";
    for (Annotation annotation : jaxbClass.getPackage().getAnnotations()) {
        if (annotation.annotationType() == XmlSchema.class) {
            nsURI = ((XmlSchema) annotation).namespace();
            break;
        }/*from   w  w w  .j  a va  2s . co  m*/
    }
    return nsURI;
}

From source file:at.tuwien.ifs.somtoolbox.doc.RunnablesReferenceCreator.java

public static boolean isMainApp(Class<? extends SOMToolboxApp> c) {
    return c.getPackage().getName().endsWith(".apps") || c.getPackage().getName().endsWith(".viewer")
            || c.getPackage().getName().endsWith(".models");
}

From source file:com.netflix.iep.config.Configuration.java

public static <T> T apply(Class<T> ctype) {
    String pkg = ctype.getPackage().getName();
    String prefix = (pkg.startsWith("com.")) ? pkg.substring("com.".length()) : pkg;
    return newProxy(ctype, prefix);
}