List of usage examples for java.lang Class getSimpleName
public String getSimpleName()
From source file:com.cloudera.csd.validation.references.components.ReflectionHelperTest.java
private static Method method(Class<?> clazz, String name) { Method m = ReflectionUtils.findMethod(clazz, name); assertNotNull("Method name: " + name + " for class: " + clazz.getSimpleName(), m); return m;/* w w w . j a v a 2s . c om*/ }
From source file:com.redhat.lightblue.util.metrics.DropwizardRequestMetrics.java
/** * Create exception namespace for metric reporting based on exception name. * /*from ww w . j ava2s.c om*/ */ private static String errorNamespace(String metricNamespace, Throwable exception, String errorMessage) { Class<? extends Throwable> actualExceptionClass = unravelReflectionExceptions(exception); return name(metricNamespace, "requests", "exception", actualExceptionClass.getSimpleName(), errorMessage); }
From source file:com.braffdev.server.core.io.logger.Logger.java
/** * Constructs a new logger with the name of the given class. * * @param clazz the class./*w w w . j ava 2 s . co m*/ * @return the constructed logger. */ public static Logger getLogger(Class<?> clazz) { return Logger.getLogger(clazz.getSimpleName()); }
From source file:ips1ap101.lib.core.web.app.EJBL.java
public static Object lookup(Class<?> interfaz) { Bitacora.trace(EJBL.class, "lookup", interfaz); String key = EAC.JNDI_EJB_LOOKUP_PATTERN; String pattern = EA.getString(key); String base = interfaz.getSimpleName(); String bean = StringUtils.removeEnd(base, "Base") + "Bean"; String jndi = MessageFormat.format(pattern, bean, interfaz.getName()); Bitacora.trace(key + "=" + pattern); Bitacora.trace(key + "=" + jndi); try {/*from w w w. j a va2 s . c o m*/ Object facade = InitialContext.doLookup(jndi); boolean assignable = facade != null && interfaz.isAssignableFrom(facade.getClass()); Bitacora.trace(bean + "=" + facade); Bitacora.trace(base + "=" + assignable); return facade; } catch (NamingException ex) { throw new RuntimeException(ex); } }
From source file:com.pandich.dropwizard.curator.refresh.CuratorRefresherManager.java
private static void initialSetup(final List<Class<? extends CuratorRootConfiguration>> configurationClasses, final Refresher<Field> fieldRefresher, final Refresher<Method> methodRefresher) throws Exception { for (final Class<? extends CuratorRootConfiguration> configurationClass : configurationClasses) { log.debug("configuration class: {}", configurationClass.getSimpleName()); final Reflections fieldReflections = new Reflections(configurationClass, new FieldAnnotationsScanner()); for (final Field field : Sets.filter(fieldReflections.getFieldsAnnotatedWith(CuratorInject.class), fieldIsValid)) {/*from www .j a v a 2 s. c om*/ fieldRefresher.refresh(configurationClass, field); } final Reflections methodReflections = new Reflections(configurationClass, new MethodAnnotationsScanner()); for (final Method method : Sets.filter(methodReflections.getMethodsAnnotatedWith(CuratorInject.class), methodIsValid)) { methodRefresher.refresh(configurationClass, method); } } if (log.isDebugEnabled()) { for (final Map.Entry<Class, ConcurrentMap<String, PropertySource>> classEntry : fieldRefresher.propertySources) { for (final Map.Entry<String, PropertySource> propertyEntry : classEntry.getValue().entrySet()) { log.debug("source: {}.{}={}", new Object[] { classEntry.getKey(), propertyEntry.getKey(), propertyEntry.getValue() }); } } for (final Map.Entry<Class, ConcurrentMap<String, PropertySource>> classEntry : methodRefresher.propertySources) { for (final Map.Entry<String, PropertySource> propertyEntry : classEntry.getValue().entrySet()) { log.debug("source: {}.{}({})", new Object[] { classEntry.getKey(), propertyEntry.getKey(), propertyEntry.getValue() }); } } } }
From source file:de.iteratec.iteraplan.businesslogic.exchange.common.vbb.impl.util.VisualVariableHelper.java
private static EClassifier getEEnum(EPackage vvEPackage, Class<? extends Enum<?>> enumClass) { if (vvEPackage.getEClassifier(enumClass.getSimpleName()) == null) { EEnum result = EcoreFactory.eINSTANCE.createEEnum(); result.setName(enumClass.getSimpleName()); result.setInstanceClass(enumClass); for (Enum<?> enumValue : enumClass.getEnumConstants()) { EEnumLiteral lit = EcoreFactory.eINSTANCE.createEEnumLiteral(); lit.setValue(enumValue.ordinal()); lit.setName(enumValue.name()); result.getELiterals().add(lit); }/* w w w .ja v a 2 s.c om*/ vvEPackage.getEClassifiers().add(result); } return vvEPackage.getEClassifier(enumClass.getSimpleName()); }
From source file:net.eledge.android.toolkit.db.internal.FieldType.java
public static FieldType getType(Class<?> clazz) { if (clazz.isEnum()) { return ENUM; }//from w w w .ja va2s . c o m String type = clazz.getSimpleName(); if ("int".equals(type)) { return INTEGER; } return valueOf(type.toUpperCase(Locale.ENGLISH)); }
From source file:py.una.pol.karaku.test.util.TestUtils.java
/** * Retorna la lista de entidades relacionadas a una base. * /*from www .j a v a2s . c o m*/ * @param base * entidad base * @return array con todas las entidades que se pueden acceder desde base. */ public static Class<?>[] getReferencedClasses(Class<?> base) { LOG.info("Scanning for classes with relations with '{}'", base.getName()); Set<Class<?>> result = getReferencedClasses(base, new HashSet<Class<?>>(10)); result.add(base); for (Class<?> c : result) { LOG.info("Found class {} ", c.getSimpleName()); } LOG.info("Found '{}' classes with relations with '{}'", result.size(), base.getSimpleName()); return result.toArray(new Class<?>[result.size()]); }
From source file:hudson.model.UserIdMigratorTest.java
static void copyTestDataIfExists(Class clazz, TestName testName, File tempDirectory) throws IOException { File resourcesDirectory = new File(BASE_RESOURCE_PATH + clazz.getSimpleName(), testName.getMethodName()); if (resourcesDirectory.exists()) { FileUtils.copyDirectory(resourcesDirectory, tempDirectory); }/*from ww w . jav a 2 s. c o m*/ }
From source file:com.oembedler.moon.graphql.engine.dfs.ResolvableTypeAccessor.java
public static ResolvableTypeAccessor forClass(Class<?> rawClass) { return new ResolvableTypeAccessor(rawClass.getSimpleName(), null, Lists.newArrayList(rawClass.getAnnotations()), rawClass); }