public class ToStringOption extends Object
| 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
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
null, meaning all parent class declared
fields will be outputpublic boolean appendTransient
public boolean appendStatic
public ToStringOption()
DEFAULT_OPTIONpublic ToStringOption(boolean appendStatic,
boolean appendTransient)
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)
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)
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 cloneappendTransient - DEFAULT_OPTIONpublic ToStringOption setAppendStatic(boolean appendStatic)
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 cloneappendStatic - DEFAULT_OPTIONpublic ToStringOption setUpToClass(Class<?> c)
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 clonec - DEFAULT_OPTIONpublic String toString()
return Rythm.toString(
"{appendStatic: @_.appendStatic; " +
"appendTransient: @_.appendTransient; " +
upToClass: @_.upToClass?.getName()}", this);
public static ToStringOption valueOf(String s)
ToStringOption instance out from a string. The format
of the String should be the same as the format output of toString()
methods - Copyright © 2015. All Rights Reserved.