List of usage examples for java.lang Class getSimpleName
public String getSimpleName()
From source file:me.hurel.hqlbuilder.internal.ProxyUtil.java
public static String toAlias(Class<?> entity) { return StringUtils.uncapitalize(entity.getSimpleName()); }
From source file:de.vandermeer.asciitable.commons.Table_ToStringStyle.java
/** * Returns a builder using parent class, class and value. * @param parent parent class for the string * @param clazz current class for the string * @param values values for the string, printed comma separated * @return a StrBuilder combining the inputs *///w w w . ja va 2 s .c om public static StrBuilder parentKV(Class<?> parent, Class<?> clazz, Object... values) { StrBuilder ret = new StrBuilder(50).append(parent.getSimpleName()).append('(').append(clazz.getSimpleName()) .append(')').append(": ").appendWithSeparators(values, ", "); ; return ret; }
From source file:mx.dr.ml.service.util.WebServiceLocator.java
/** * Get Spring Service Bean Instance/*w w w . j a v a 2s. c o m*/ * @param clazz Service class * @param context application sevlet context * @return service Instance */ public static <T extends Object> T getBean(Class clazz, ServletContext context) { return (T) WebApplicationContextUtils.getRequiredWebApplicationContext(context) .getBean(clazz.getSimpleName()); }
From source file:Main.java
public static void log(Class<? extends Object> clazz, String msg) { if (isLog) {//from w ww.ja v a 2 s.c o m log(DEFAULT_TAG, Log.INFO, String.format("%s : %s", clazz.getSimpleName(), msg), null); } }
From source file:Main.java
private static Class<?> getActivityClass(Context context, Class<?> classObj) { StringBuilder b = new StringBuilder(255); b.append(context.getPackageName());//from ww w .j a v a 2s . co m b.append("."); b.append(classObj.getSimpleName()); b.append("Ext"); String extClassName = b.toString(); try { Class<?> extClass = Class.forName(extClassName); return extClass; } catch (ClassNotFoundException e) { //e.printStackTrace(); // DEBUG: uncomment to debug return classObj; } }
From source file:com.autentia.common.util.StringUtils.java
public static <T> String generateNameOfEntityAttributeInMessagesFile(Class<T> entity, String attributeName) { final StringBuilder builder = new StringBuilder(); builder.append(entity.getSimpleName()).append(".").append(attributeName); return builder.toString(); }
From source file:ch.ifocusit.plantuml.utils.ClassUtils.java
public static String _getSimpleName(Class aClass) { String className = aClass.getSimpleName(); int lastDollarSign = className.lastIndexOf(DOLLAR); if (lastDollarSign != -1) { String innerClassName = className.substring(lastDollarSign + 1); // local and anonymous classes are prefixed with number (1,2,3...), anonymous classes are // entirely numeric whereas local classes have the user supplied name as a suffix return CharMatcher.digit().trimLeadingFrom(innerClassName); }/* w w w. ja va2 s . co m*/ return className; }
From source file:com.piusvelte.taplock.client.core.TapLock.java
@SuppressWarnings("rawtypes") protected static Class getPackageClass(Context context, Class cls) { try {/*from ww w .j a v a2s .c om*/ return Class.forName(context.getPackageName() + "." + cls.getSimpleName()); } catch (ClassNotFoundException e) { Log.e(TAG, e.getMessage()); } return cls; }
From source file:de.cbb.mplayer.util.ReflectionHelper.java
public static String getterName(String field, Class type) { if (Boolean.class.getSimpleName().toLowerCase().equals(type.getSimpleName().toLowerCase())) return "is" + WordUtils.capitalize(field); else/*from ww w . java 2 s . c o m*/ return "get" + WordUtils.capitalize(field); }
From source file:com.abiquo.model.util.ModelTransformer.java
public static <T> void transform(final Class sourceClass, final Class<T> targetClass, final Object source, final T target) throws Exception { Field[] transportFields = sourceClass.getDeclaredFields(); Class superClass = sourceClass.getSuperclass(); while (!superClass.getSimpleName().equalsIgnoreCase("SingleResourceTransportDto")) { transportFields = (Field[]) ArrayUtils.addAll(transportFields, superClass.getDeclaredFields()); superClass = superClass.getSuperclass(); }/*from w w w . j av a 2 s . c o m*/ for (Field field : transportFields) { int modifiers = field.getModifiers(); if (!Modifier.isTransient(modifiers) && !Modifier.isStatic(modifiers)) { String name = field.getName(); try { if (fieldExist(name, targetClass) && fieldExist(name, source.getClass()) || getterExist(name, source.getClass()) && setterExist(name, targetClass, field.getType())) { Object value = getter(name, source.getClass()).invoke(source, new Object[0]); if (setterExist(name, targetClass, field.getType())) { setter(name, targetClass, field.getType()).invoke(target, new Object[] { value }); } } } catch (InvocationTargetException e) { // Ignore invalid field } } } }