public class ToStringOption extends Object implements Serializable
Defines the options can be set when output an object into string
| Modifier and Type | Field and Description |
|---|---|
boolean |
appendStatic
Whether output static fields
|
boolean |
appendTransient
Whether output transient fields
|
static ToStringOption |
DEFAULT_OPTION
The default option instance, with
upToClassset to null, meaning up to Object root appendTransient set to false, will not output transient fields appendStatic set to false, will not output static fields |
Class<?> |
upToClass
Specify the up most parent class whose declared fields will be output.
|
| Constructor and Description |
|---|
ToStringOption()
Construct an new default option
|
ToStringOption(boolean appendStatic,
boolean appendTransient)
Construct an option with specified appendStatic and appendTransient switch.
|
ToStringOption(boolean appendStatic,
boolean appendTransient,
Class<?> upToClass)
Construct an option with static, transient output switch and upToClass
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
int |
hashCode() |
ToStringOption |
setAppendStatic(boolean appendStatic)
Return a
ToStringOption instance with appendStatic option set. |
ToStringOption |
setAppendTransient(boolean appendTransient)
Return a
ToStringOption instance with appendTransient option set. |
ToStringOption |
setUpToClass(Class<?> c)
Return a
ToStringOption instance with upToClass option set. |
String |
toString()
Print this to string option instance using the following logic:
|
static ToStringOption |
valueOf(String s)
Construct a
ToStringOption instance out from a string. |
public static final ToStringOption DEFAULT_OPTION
The default option instance, with
upToClassset to null, meaning up to Object rootappendTransient set to false, will not output transient fieldsappendStatic set to false, will not output static fieldspublic Class<?> upToClass
Specify the up most parent class whose declared fields will be output. Default value is null, meaning all parent class declared fields will be output
public boolean appendTransient
Whether output transient fields
public boolean appendStatic
Whether output static fields
public ToStringOption()
Construct an new default option
DEFAULT_OPTIONpublic ToStringOption(boolean appendStatic,
boolean appendTransient)
Construct an option with specified appendStatic and appendTransient switch.
appendStatic - when set to true the static fields will be outputappendTransient - when set to true the transient fields will be outputpublic ToStringOption(boolean appendStatic,
boolean appendTransient,
Class<?> upToClass)
Construct an option with static, transient output switch and upToClass
appendStatic - when set to true the static fields will be outputappendTransient - when set to true the trasient fields will be outputupToClass - when set then the fields up to this parent class will be output, otherwise it will be up to Object rootpublic ToStringOption setAppendTransient(boolean appendTransient)
Return a ToStringOption instance with appendTransient option set. if the current instance is not default instance then set on the current instance and return the current instance. Otherwise, clone the default instance and set on the clone and return the clone
appendTransient - DEFAULT_OPTIONpublic ToStringOption setAppendStatic(boolean appendStatic)
Return a ToStringOption instance with appendStatic option set. if the current instance is not default instance then set on the current instance and return the current instance. Otherwise, clone the default instance and set on the clone and return the clone
appendStatic - DEFAULT_OPTIONpublic ToStringOption setUpToClass(Class<?> c)
Return a ToStringOption instance with upToClass option set. if the current instance is not default instance then set on the current instance and return the current instance. Otherwise, clone the default instance and set on the clone and return the clone
c - DEFAULT_OPTIONpublic String toString()
Print this to string option instance using the following logic:
return Rythm.toString( “{appendStatic: @_.appendStatic; ” + “appendTransient: @_.appendTransient; ” + upToClass: @_.upToClass?.getName()}", this); public static ToStringOption valueOf(String s)
Construct a ToStringOption instance out from a string. The format of the String should be the same as the format output of toString() method
s - Copyright © 2017–2021 OSGL (Open Source General Library). All rights reserved.