List of usage examples for java.util StringJoiner setEmptyValue
public StringJoiner setEmptyValue(CharSequence emptyValue)
From source file:iterator.test.matchers.type.annotation.AnnotationMap.java
@Override public String toString() { StringBuilder sb = new StringBuilder("@"); sb.append(getAnnotationClass().getSimpleName()); StringJoiner joiner = new StringJoiner(COMMA, "(", ")"); joiner.setEmptyValue(EMPTY); if (members.containsKey("value")) { MemberValue<?> mv = members.get("value"); if (mv.isUndefined() || !mv.isDefault()) { if (members.size() > 1 && members.entrySet().stream().filter(entry -> !"value".equals(entry.getKey())) .anyMatch(entry -> !entry.getValue().isDefault())) { joiner.add(String.format("value = %s", mv)); } else { joiner.add(mv.toString()); }/*from w w w. java2 s . co m*/ } } members.entrySet().stream().filter(entry -> !"value".equals(entry.getKey()) && (entry.getValue().isUndefined() || !entry.getValue().isDefault())).forEach(entry -> { joiner.add(String.format("%s = %s", entry.getKey(), entry.getValue())); }); sb.append(joiner.toString()); return sb.toString(); }