mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-06-02 10:57:49 +08:00
writeClassname
This commit is contained in:
@@ -333,7 +333,9 @@ public class DefaultToStringOperator<T> implements ToStringOperator<T> {
|
||||
if (ToString.Feature.hasFeature(features, ToString.Feature.jsonFormat)) {
|
||||
return JSON.toJSONString(mapValue);
|
||||
}
|
||||
StringJoiner joiner = new StringJoiner(", ", target.getClass().getSimpleName() + "(", ")");
|
||||
boolean writeClassName = ToString.Feature.hasFeature(features, ToString.Feature.writeClassname);
|
||||
|
||||
StringJoiner joiner = new StringJoiner(", ", (writeClassName ? target.getClass().getSimpleName() : "") + "(", ")");
|
||||
|
||||
mapValue.forEach((key, value) -> joiner.add(key.concat("=").concat(String.valueOf(value))));
|
||||
|
||||
|
||||
@@ -95,7 +95,14 @@ public class ToString {
|
||||
*
|
||||
* @since 3.0.0-RC
|
||||
*/
|
||||
jsonFormat;
|
||||
jsonFormat,
|
||||
|
||||
/**
|
||||
* 是否写出类名
|
||||
*
|
||||
* @since 3.0.0-RC
|
||||
*/
|
||||
writeClassname;
|
||||
|
||||
|
||||
public long getMask() {
|
||||
|
||||
@@ -12,21 +12,23 @@ import lombok.*;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class NestObject implements Cloneable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToString.toString(this);
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
private int age;
|
||||
|
||||
|
||||
@ToString.Ignore
|
||||
private String password ;
|
||||
private String password;
|
||||
|
||||
|
||||
@Override
|
||||
public NestObject clone() throws CloneNotSupportedException {
|
||||
return (NestObject) super.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToString.toString(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user