/** * Convert Java object to a JSON string. * * @param val Java object * @return JSON string. */ public static String toJsonString(Object val) { return toJsonString(val, false); }
/** * @return JSON representation of context. Expect a JSON object <code>"{...}"</code> if values are present, * or <code>null</code> if no values were set. */ public static String toJSON(){ Map context = contextTL.get(); return context == null || context.isEmpty() ? null : JsonHelper.toJsonString(context); } }
protected String toJSON() { List models = new ArrayList(); metaModelsByTableName.values().forEach(metaModel -> { List associations = new ArrayList(); metaModel.getAssociations().forEach(association -> associations.add(association.toMap())); models.add(map( MODEL_CLASS, metaModel.getModelClass().getName(), DB_TYPE, metaModel.getDbType(), DB_NAME, metaModel.getDbName(), COLUMN_METADATA, metaModel.getColumnMetadata(), ASSOCIATIONS, associations )); }); return JsonHelper.toJsonString(models,false); }
/** * Convert Java object to a JSON string. * * @param val Java object * @return JSON string. */ public static String toJsonString(Object val) { return toJsonString(val, false); }
/** * @return JSON representation of context. Expect a JSON object <code>"{...}"</code> if values are present, * or <code>null</code> if no values were set. */ public static String toJSON(){ Map context = contextTL.get(); return context == null || context.isEmpty() ? null : JsonHelper.toJsonString(context); } }
@Override public void onMessage(Message message) { Context.clear(); try { Command command = parseCommand(message); command.setJMSMessageID(message.getJMSMessageID()); if (injector != null) { injector.injectMembers(command); } long start = System.currentTimeMillis(); onCommand(command); LOGGER.info(JsonHelper.toJsonString(map("processed_millis", (System.currentTimeMillis() - start), "command", command.getClass().getSimpleName()))); } catch (Exception e) { LOGGER.error("Failed to process message: {}", getCommandAsText(message), e); throw new AsyncException("Failed to process message", e); }finally { Context.clear(); } }
@Override public void onMessage(Message message) { Context.clear(); try { Command command = parseCommand(message); command.setJMSMessageID(message.getJMSMessageID()); if (injector != null) { injector.injectMembers(command); } long start = System.currentTimeMillis(); onCommand(command); LOGGER.info(JsonHelper.toJsonString(map("processed_millis", (System.currentTimeMillis() - start), "command", command.getClass().getSimpleName()))); } catch (Exception e) { LOGGER.error("Failed to process message: {}", getCommandAsText(message), e); throw new AsyncException("Failed to process message", e); }finally { Context.clear(); } }
logger.error(JsonHelper.toJsonString(log), throwable); }else { logger.info(JsonHelper.toJsonString(log));