List of usage examples for java.lang Class getSimpleName
public String getSimpleName()
From source file:edu.usu.sdl.openstorefront.doc.JaxrsProcessor.java
private static void mapComplexTypes(List<APITypeModel> typeModels, Field fields[], boolean onlyConsumeField) { //Should strip duplicate types Set<String> typesInList = new HashSet<>(); typeModels.forEach(type -> {/*from w ww . ja va 2 s . c o m*/ typesInList.add(type.getName()); }); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.enable(SerializationFeature.INDENT_OUTPUT); objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); for (Field field : fields) { boolean capture = true; if (onlyConsumeField) { ConsumeField consumeField = (ConsumeField) field.getAnnotation(ConsumeField.class); if (consumeField == null) { capture = false; } } if (capture) { Class fieldClass = field.getType(); DataType dataType = (DataType) field.getAnnotation(DataType.class); if (dataType != null) { fieldClass = dataType.value(); } if (ReflectionUtil.isComplexClass(fieldClass)) { APITypeModel typeModel = new APITypeModel(); typeModel.setName(fieldClass.getSimpleName()); APIDescription aPIDescription = (APIDescription) fieldClass.getAnnotation(APIDescription.class); if (aPIDescription != null) { typeModel.setDescription(aPIDescription.value()); } Set<String> fieldList = mapValueField(typeModel.getFields(), fieldClass.getDeclaredFields(), onlyConsumeField); if (fieldClass.isEnum()) { typeModel.setObject(Arrays.toString(fieldClass.getEnumConstants())); } else { if (fieldClass.isInterface() == false) { try { typeModel.setObject(objectMapper.writeValueAsString(fieldClass.newInstance())); String cleanUpJson = StringProcessor.stripeFieldJSON(typeModel.getObject(), fieldList); typeModel.setObject(cleanUpJson); } catch (InstantiationException | IllegalAccessException | JsonProcessingException ex) { log.log(Level.WARNING, "Unable to process/map complex field: " + fieldClass.getSimpleName(), ex); typeModel.setObject("{ Unable to view }"); } mapComplexTypes(typeModels, fieldClass.getDeclaredFields(), onlyConsumeField); } } typeModels.add(typeModel); typesInList.add(typeModel.getName()); } } } }
From source file:de.openknowledge.cdi.monitoring.ComponentStatus.java
public ComponentStatus(Class aClazz, Throwable t) { this(aClazz.getSimpleName(), t); }
From source file:com.avanza.ymer.MirrorEnvironment.java
public void removeFormatVersion(Class<?> dataType, Object id) { String collectionName = dataType.getSimpleName().substring(0, 1).toLowerCase() + dataType.getSimpleName().substring(1); DBCollection collection = getMongoDb().getCollection(collectionName); DBObject idQuery = BasicDBObjectBuilder.start("_id", id).get(); DBCursor cursor = collection.find(idQuery); cursor.next();// w ww . j a v a2s . co m DBObject obj = cursor.curr(); cursor.close(); obj.removeField("_formatVersion"); collection.update(idQuery, obj); }
From source file:org.brunocvcunha.jiphy.requests.base.JiphyRequest.java
/** * Parses Json into type// w w w . j ava 2 s. c o m * * @param str * Entity content * @param clazz * Class * @return Result */ @SneakyThrows public <U> U parseJson(String str, Class<U> clazz) { log.info("Reading " + clazz.getSimpleName() + " from " + str); return new ObjectMapper().readValue(str, clazz); }
From source file:jp.co.opentone.bsol.linkbinder.dao.DaoFinder.java
private String getDaoName(Class<?> daoClass) { String daoName = daoClass.getSimpleName(); String beanName = daoName.substring(0, 1).toLowerCase(Locale.getDefault()) + daoName.substring(1); // ?Mock??//from w w w. j a va 2 s . c o m if (isUseMock(daoName)) { return String.format("%sMock", beanName); } else { return String.format("%sImpl", beanName); } }
From source file:com.egt.core.aplicacion.Bitacora.java
private static String getCallingMethodStackTraceElementTrack(Class clase, String metodo, int argumentos) { StackTraceElement trace = getCallingMethodStackTraceElement(); String track = getStackTraceElementTrack(trace); String firma = clase == null || clase.getName().equals(trace.getClassName()) ? getFirmaMetodo("", metodo, argumentos) : getFirmaMetodo(clase.getSimpleName(), metodo, argumentos); /**//*from w w w.ja v a 2 s .co m*/ return firma + track; }
From source file:org.syncope.core.persistence.dao.impl.AttrDAOImpl.java
@Override public <T extends AbstractAttr> List<T> findAll(final Class<T> reference) { Query query = entityManager.createQuery("SELECT e FROM " + reference.getSimpleName() + " e"); return query.getResultList(); }
From source file:atg.tools.dynunit.nucleus.NucleusUtils.java
public static Nucleus startNucleusWithModules(String[] modules, Class classRelativeTo, String initialService) throws ServletException, FileNotFoundException { return startNucleusWithModules( new NucleusStartupOptions(modules, classRelativeTo, classRelativeTo.getSimpleName() + "/config", // FIXME: factor into private method initialService));/*from w w w . ja v a 2s .c om*/ }
From source file:com.springsource.greenhouse.database.GreenhouseTestDatabaseBuilder.java
public GreenhouseTestDatabaseBuilder testData(Class<?> testClass) { populator.addScript(new ClassPathResource(testClass.getSimpleName() + ".sql", testClass)); return this; }
From source file:org.syncope.core.persistence.dao.impl.AttrValueDAOImpl.java
@Override public <T extends AbstractAttrValue> List<T> findAll(final Class<T> reference) { Query query = entityManager.createQuery("SELECT e FROM " + reference.getSimpleName() + " e"); return query.getResultList(); }