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:edu.utah.further.core.ws.WsUtil.java

/**
 * Return the convention path for both SOAP and REST web service classes. All web
 * service classes are assumed to end with "ServiceSoap" or "ServiceRest". The
 * correspondence is then: class "MyServiceSoap" -> path "my"; class "MyServiceRest"
 * -> path "my".//from  ww w .  ja  va2  s .c  o m
 *
 * @param serviceClass
 *            SOAP or REST service class
 * @return corresponding web service deployment path
 */
public static String getWebServiceClassPath(final Class<?> serviceClass) {
    return WordUtils.uncapitalize(serviceClass.getSimpleName().replaceAll(SERVICE_SOAP_SUFFIX, EMPTY_STRING)
            .replaceAll(SERVICE_REST_SUFFIX, EMPTY_STRING));
}

From source file:com.github.steveash.spring.WiringFactoryBeanFactoryPostProcessor.java

@Nullable
static java.lang.String getPrototypeBeanNameFromBeanClass(Class<?> prototypeBeanClass) {
    String prototypeBeanName = prototypeBeanClass.getSimpleName();
    return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, prototypeBeanName);
}

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:de.webtech2.croaking.services.impl.Invoker.java

public static String invoke(Class<?> clazz, Object... arguments) {
    StringBuilder builder = new StringBuilder();

    builder.append(clazz.getSimpleName()).append("(");

    if (arguments != null) {
        builder.append(StringUtils.join(arguments, ", "));
    }//from  w w  w  . j a v a2  s .  co  m

    builder.append(").").append(SUCCESS_SUFFIX);

    return builder.toString();
}

From source file:Main.java

public static Object typeConversion(Class<?> cls, String str) {
    Object obj = null;//w  w w.j  a v a 2 s.com
    String nameType = cls.getSimpleName();
    if ("Integer".equals(nameType)) {
        obj = Integer.valueOf(str);
    }
    if ("String".equals(nameType)) {
        obj = str;
    }
    if ("Float".equals(nameType)) {
        obj = Float.valueOf(str);
    }
    if ("Double".equals(nameType)) {
        obj = Double.valueOf(str);
    }

    if ("Boolean".equals(nameType)) {
        obj = Boolean.valueOf(str);
    }
    if ("Long".equals(nameType)) {
        obj = Long.valueOf(str);
    }

    if ("Short".equals(nameType)) {
        obj = Short.valueOf(str);
    }

    if ("Character".equals(nameType)) {
        obj = str.charAt(1);
    }

    return obj;
}

From source file:com.vaadin.spring.internal.Conventions.java

public static String deriveMappingForView(Class<?> beanClass, SpringView annotation) {
    if (annotation != null && !SpringView.USE_CONVENTIONS.equals(annotation.name())) {
        return annotation.name();
    } else {// w  w w.ja v a  2s  .  co m
        // derive mapping from classname
        // do not use proxy class names
        Class<?> realBeanClass = ClassUtils.getUserClass(beanClass);
        String mapping = realBeanClass.getSimpleName().replaceFirst("View$", "");
        return upperCamelToLowerHyphen(mapping);
    }
}

From source file:jfk.core.JFK.java

/**
 * Gets a bean (pluggable and configurable) for the system.
 * @param clazz the class (interface) to get the bean for, its simple name is used in
 * the configuration./*from www .j a va 2s. co m*/
 * @return the bean from the configuration of this system
 */
public static synchronized Object getBean(final Class clazz) {
    return xmlBeanFactory.getBean(clazz.getSimpleName());
}

From source file:de.vandermeer.skb.interfaces.categories.has.HasToLog.java

/**
 * Returns a builder using containment class, contained class, and values.
 * @param container the contain object class
 * @param contained contained object class
 * @param values values, printed comma separated
 * @return an `StrBuilder` combining the inputs
 *//*from   w w w .j  a va 2  s  . co  m*/
static StrBuilder toLog(Class<?> container, Class<?> contained, Object... values) {
    StrBuilder ret = new StrBuilder(50).append(container.getSimpleName()).append('(')
            .append(contained.getSimpleName()).append(')').append(": ").appendWithSeparators(values, ", ");
    ;
    return ret;
}

From source file:Main.java

public static String getProcessName(Class<?> clazz) {
    if (clazz.isAnonymousClass()) {
        return getProcessName(clazz.getEnclosingClass());
    }/*from   www . ja v a  2  s . c  o m*/
    return clazz.getSimpleName();
}