List of usage examples for java.lang Class getSimpleName
public String getSimpleName()
From source file:br.gov.frameworkdemoiselle.util.contrib.Reflections.java
public static Field getAnnotatedField(Class<?> clazz, Class<? extends Annotation> aclazz, boolean required) throws Exception { for (Field field : getSuperClassesFields(clazz)) if (field.isAnnotationPresent(aclazz)) return field; if (required) throw new Exception( "Field with @" + aclazz.getSimpleName() + " not found on class " + clazz.getSimpleName()); else//from ww w . j av a2 s. c o m return null; }
From source file:com.reprezen.kaizen.oasparser.jsonoverlay.gen.TypeGenerator.java
private static Set<String> getAutoTypes() { Set<String> results = Sets.newHashSet(); ArrayList<Class<?>> autos = Lists.<Class<?>>newArrayList(// String.class, // Integer.class, // Number.class, // Boolean.class, // Primitive.class, // Object.class); for (Class<?> cls : autos) { results.add(cls.getSimpleName()); }/*from w w w .ja va 2 s . c om*/ return results; }
From source file:org.web4thejob.context.ContextUtil.java
@SuppressWarnings("unchecked") public static <T extends Panel> T getDefaultPanel(Class<T> clazz, Object... args) { return (T) rootContext.getBean(DEFAULT_PREFFIX + clazz.getSimpleName(), args); }
From source file:com.lily.dap.util.ReflectionUtils.java
/** * , Class./*from w w w .j a va 2 s. co m*/ * , Object.class. * * public UserDao extends HibernateDao<User,Long> * * @param clazz clazz The class to introspect * @param index the Index of the generic ddeclaration,start from 0. * @return the index generic declaration, or Object.class if cannot be determined */ public static Class getSuperClassGenricType(final Class clazz, final int index) { Type genType = clazz.getGenericSuperclass(); if (!(genType instanceof ParameterizedType)) { logger.warn(clazz.getSimpleName() + "'s superclass not ParameterizedType"); return Object.class; } Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); if (index >= params.length || index < 0) { logger.warn("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " + params.length); return Object.class; } if (!(params[index] instanceof Class)) { logger.warn(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); return Object.class; } return (Class) params[index]; }
From source file:com.dapeng.dao.orm.GenericsUtils.java
/** * ??, Class?.//from www .ja v a2 s . co m * , Object.class. * * public UserDao extends HibernateDao<User,Long> * * @param clazz clazz The class to introspect * @param index the Index of the generic ddeclaration,start from 0. * @return the index generic declaration, or Object.class if cannot be determined */ public static Class getSuperClassGenricType(final Class clazz, final int index) { Type genType = clazz.getGenericSuperclass(); if (!(genType instanceof ParameterizedType)) { logger.warn(clazz.getSimpleName() + "'s superclass not ParameterizedType"); return Object.class; } Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); if (index >= params.length || index < 0) { logger.warn("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " + params.length); return Object.class; } if (!(params[index] instanceof Class)) { logger.warn(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); return Object.class; } return (Class) params[index]; }
From source file:org.web4thejob.context.ContextUtil.java
@SuppressWarnings("unchecked") public static <T extends Dialog> T getDialog(Class<T> type, Object... args) { return (T) ContextUtil.getBean(StringUtils.uncapitalize(type.getSimpleName()), args); }
From source file:hu.petabyte.redflags.engine.gear.indicator.AbstractIndicator.java
/** * Generates an identifier for the given indicator class from the name of * the direct parent package and the simple class name. So * <code>hu.petabyte.redflags.engine.gear.indicator.hu.AwCritLacksIndicator</code> * will have <code>hu.AwCritLacksIndicator</code> as its identifier. * * @param clazz// w w w.j av a 2 s. c o m * Indicator class to generate identifier for * @return Identifier for the indicator generated from the name of the * direct parent package and the simple class name. */ public static String getIdForIndicatorClass(Class<? extends AbstractIndicator> clazz) { Matcher m = Pattern.compile("(^|.*\\.)([^.]+\\.[^.]+)$").matcher(clazz.getName()); return m.find() ? m.group(2) : clazz.getSimpleName(); }
From source file:com.jdom.junit.utils.AbstractFixture.java
/** * Setup the directory the test class should use. * //from w w w . j ava 2s.c o m * @param testClass * The test class to create a directory for * @return The directory created for the test class */ public static File setupTestClassDir(Class<?> testClass) { setupTempDir(); File dir = new File(streamTempDir, testClass.getSimpleName()); // Delete any preexisting version try { FileUtils.deleteDirectory(dir); } catch (IOException e) { throw new IllegalStateException(e); } // Make the directory dir.mkdirs(); return dir; }
From source file:io.leishvl.core.data.AnnotationCollectionUtils.java
public static final String getCollectionName(final Class<?> clazz) { String collection = null;//w ww .j av a2s . c om if (clazz != null) { final Annotation annotation = clazz.getAnnotation(Document.class); if (annotation instanceof Document) { collection = ((Document) annotation).collection(); } if (isBlank(collection)) collection = uncapitalize(clazz.getSimpleName()); } return collection; }
From source file:org.camunda.bpm.spring.boot.starter.property.CamundaBpmProperties.java
static StringJoiner joinOn(final Class<?> clazz) { return new StringJoiner(", ", clazz.getSimpleName() + "[", "]"); }