@Test @DisplayName("Find All Items") public void testFindAll() { List<Item> items = classUnderTest.findAll(); assertNotNull(items); assertAll( () -> assertFalse(items.isEmpty()), () -> assertEquals(7, items.size())); if (log.isDebugEnabled()) { log.debug("Items found: "); for (Item item : items) { log.debug(ReflectionToStringBuilder.toString(item, new RecursiveToStringStyle())); } } }
/** * To be used in {@link Object#toString()} implementations. * * Might arbitrarily throw exceptions. Therefore, Please consider to reimplement this, or to use e.g. {@link com.google.common.base.MoreObjects#toStringHelper(Object)}. * * @param obj the object to be printed * @param multiLine if <code>true</code> then use {@link RecursiveIndentedMultilineToStringStyle} to display it in multiple lines. * @return * */ public static final String toString(final Object obj, final boolean multiLine) { if (obj == null) { return "<NULL>"; } try { final ToStringStyle toStringStyle; if (multiLine) { toStringStyle = RecursiveIndentedMultilineToStringStyle.instance; } else { toStringStyle = RecursiveToStringStyle.SHORT_PREFIX_STYLE; } return new ExtendedReflectionToStringBuilder(obj, toStringStyle).toString(); } catch (final Exception e) { // task 09493: catching possible errors // this doesn't work! still invokes the "high-level" toString() method // return ((Object)obj).toString() + " (WARNING: ExtendedReflectionToStringBuilder threw " + e + ")"; return createFallBackMessage(obj, e); } }
@PostMapping @ResponseStatus(HttpStatus.CREATED) public void save(@RequestBody Dsmr42Reading dsmr42Reading) { if (LOGGER.isInfoEnabled()) { LOGGER.info(ReflectionToStringBuilder.toString(dsmr42Reading, new RecursiveToStringStyle())); } saveMeterstand(dsmr42Reading); saveOpgenomenVermogen(dsmr42Reading); }
private void debugPrint(Object o) { RecursiveToStringStyle recursiveToStringStyle = new RecursiveToStringStyle() {{ this.setContentStart("["); this.setFieldSeparatorAtStart(true); this.setFieldSeparator(SystemUtils.LINE_SEPARATOR + " "); this.setContentEnd(SystemUtils.LINE_SEPARATOR + "]"); }}; System.out.println(ToStringBuilder.reflectionToString(o, recursiveToStringStyle)); }
@Override public String toString() { return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE) .setExcludeFieldNames("acceptQueue", "executor", "flushTask", "senderTask") .toString(); }
@Override public String toString() { return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE) .toString(); }
@Override public String toString() { return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE) .setExcludeFieldNames("clock", "activeSource") .toString(); }
@Override public String toString() { return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE) .setExcludeFieldNames("tracer", "clock") .toString(); }
@Override public String toString() { return ReflectionToStringBuilder.toString(this, RecursiveToStringStyle.JSON_STYLE); }
String dump() { return ReflectionToStringBuilder.reflectionToString(this, RecursiveToStringStyle.MULTI_LINE_STYLE); }
@Override public String toString() { return ToStringBuilder.reflectionToString(this, RecursiveToStringStyle.JSON_STYLE); }