Example usage for java.lang Class getSimpleName

List of usage examples for java.lang Class getSimpleName

Introduction

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

Prototype

public String getSimpleName() 

Source Link

Document

Returns the simple name of the underlying class as given in the source code.

Usage

From source file:Main.java

/**
 * Convert a translucent themed Activity
 * {@link android.R.attr#windowIsTranslucent} back from opaque to
 * translucent following a call to/*from w w w  . j  ava 2 s  . c o m*/
 * {@link #convertActivityFromTranslucent(Activity)} .
 * <p/>
 * Calling this allows the Activity behind this one to be seen again. Once
 * all such Activities have been redrawn
 * <p/>
 * This call has no effect on non-translucent activities or on activities
 * with the {@link android.R.attr#windowIsFloating} attribute.
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@SuppressWarnings("rawtypes")
public static void convertActivityToTranslucent(Activity activity) {

    try {
        Class[] t = Activity.class.getDeclaredClasses();
        Class<?> translucentConversionListenerClazz = null;
        Class[] method = t;
        int len$ = t.length;

        for (int i$ = 0; i$ < len$; ++i$) {
            Class<?> clazz = method[i$];
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
                break;
            }
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Method var8 = Activity.class.getDeclaredMethod("convertToTranslucent",
                    translucentConversionListenerClazz, ActivityOptions.class);
            var8.setAccessible(true);
            var8.invoke(activity, new Object[] { null, null });
        } else {
            Method var8 = Activity.class.getDeclaredMethod("convertToTranslucent",
                    translucentConversionListenerClazz);
            var8.setAccessible(true);
            var8.invoke(activity, new Object[] { null });
        }
    } catch (Throwable e) {
    }
}

From source file:Main.java

public static void d(Class<?> clazz, String message, boolean printTime) {
    String tag = clazz.getSimpleName();
    d(tag, message, printTime);//from   w w w .  j  a v  a 2s .  c o  m
}

From source file:MyClass.java

public static ArrayList<String> getExceptionList(Executable exec) {
    ArrayList<String> exceptionList = new ArrayList<>();
    for (Class<?> c : exec.getExceptionTypes()) {
        exceptionList.add(c.getSimpleName());
    }//w w w. j av a  2s  .  c  o m
    return exceptionList;
}

From source file:Main.java

private static <T> JAXBContext getContext(Class<T> c) throws JAXBException {

    if (!map.containsKey(c)) {
        System.out.println("-" + c.getSimpleName());
        map.put(c, JAXBContext.newInstance(c));
    }//from   w  w w.  jav a  2s  . c  o  m

    return (JAXBContext) map.get(c);
}

From source file:Main.java

/**
 * Calling the convertToTranslucent method on platforms after Android 5.0
 *///  w w  w  .j a va 2  s  . c o m
private static void convertActivityToTranslucentAfterL(Activity activity) {
    try {
        Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
        getActivityOptions.setAccessible(true);
        Object options = getActivityOptions.invoke(activity);

        Class<?>[] classes = Activity.class.getDeclaredClasses();
        Class<?> translucentConversionListenerClazz = null;
        for (Class clazz : classes) {
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
            }
        }
        Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
                translucentConversionListenerClazz, ActivityOptions.class);
        convertToTranslucent.setAccessible(true);
        convertToTranslucent.invoke(activity, null, options);
    } catch (Throwable t) {
    }
}

From source file:test.util.TestResourceUtils.java

/**
 * Loads a {@link org.springframework.core.io.ClassPathResource} qualified by the simple name of clazz,
 * and relative to the package for clazz.
 * /* www  . j  a  v a 2s.  co m*/
 * <p>Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml',
 * this method will return a ClassPathResource representing com/foo/BarTests-context.xml
 * 
 * <p>Intended for use loading context configuration XML files within JUnit tests.
 * 
 * @param clazz
 * @param resourceSuffix
 */
public static ClassPathResource qualifiedResource(Class<?> clazz, String resourceSuffix) {
    return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), resourceSuffix), clazz);
}

From source file:hr.fer.zemris.vhdllab.util.BeanUtil.java

public static String beanName(Class<?> clazz) {
    Validate.notNull(clazz, "Bean class can't be null");
    return StringUtils.uncapitalize(clazz.getSimpleName());
}

From source file:MyClass.java

public static ArrayList<String> getMethodsDesciption(Method[] methods) {
    ArrayList<String> methodList = new ArrayList<>();

    for (Method m : methods) {
        String modifiers = getModifiers(m);

        Class returnType = m.getReturnType();
        String returnTypeName = returnType.getSimpleName();

        String methodName = m.getName();

        String params = getParameters(m).toString();

        String throwsClause = getExceptionList(m).toString();

        methodList.add(//  w  w w . ja  v  a 2s. co m
                modifiers + "  " + returnTypeName + "  " + methodName + "(" + params + ") " + throwsClause);
    }

    return methodList;
}

From source file:io.rhiot.utils.Reflections.java

public static String classNameToCamelCase(Class<?> clazz) {
    String simpleName = clazz.getSimpleName();
    return toLowerCase(simpleName.charAt(0)) + simpleName.substring(1);
}

From source file:ch.citux.td.util.Log.java

public static void e(Class caller, String message) {
    String tag = caller.getSimpleName();
    if (!StringUtils.isBlank(message)) {
        android.util.Log.e(tag, message);
    }//ww w  .j a v a  2 s .c om
}