本文整理了Java中org.apache.commons.lang.builder.ToStringBuilder.getDefaultStyle()
方法的一些代码示例,展示了ToStringBuilder.getDefaultStyle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ToStringBuilder.getDefaultStyle()
方法的具体详情如下:
包路径:org.apache.commons.lang.builder.ToStringBuilder
类名称:ToStringBuilder
方法名:getDefaultStyle
[英]Gets the default ToStringStyle
to use.
This method gets a singleton default value, typically for the whole JVM. Changing this default should generally only be done during application startup. It is recommended to pass a ToStringStyle
to the constructor instead of using this global default.
This method can be used from multiple threads. Internally, a volatile
variable is used to provide the guarantee that the latest value set using #setDefaultStyle is the value returned. It is strongly recommended that the default style is only changed during application startup.
One reason for changing the default could be to have a verbose style during development and a compact style in production.
[中]获取要使用的默认值ToStringStyle
。
此方法获取一个单例默认值,通常用于整个JVM。更改此默认值通常只能在应用程序启动期间进行。建议将ToStringStyle
传递给构造函数,而不是使用此全局默认值。
此方法可以从多个线程中使用。在内部,volatile
变量用于保证使用#setDefaultStyle设置的最新值是返回的值。强烈建议仅在应用程序启动期间更改默认样式。
更改默认设置的一个原因可能是在开发过程中使用冗长的样式,在生产过程中使用紧凑的样式。
代码示例来源:origin: commons-lang/commons-lang
/**
* <p>Constructs a builder for the specified object.</p>
*
* <p>If the style is <code>null</code>, the default style is used.</p>
*
* <p>If the buffer is <code>null</code>, a new one is created.</p>
*
* @param object the Object to build a <code>toString</code> for, not recommended to be null
* @param style the style of the <code>toString</code> to create, null uses the default style
* @param buffer the <code>StringBuffer</code> to populate, may be null
*/
public ToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer) {
if (style == null) {
style = getDefaultStyle();
}
if (buffer == null) {
buffer = new StringBuffer(512);
}
this.buffer = buffer;
this.style = style;
this.object = object;
style.appendStart(buffer, object);
}
代码示例来源:origin: org.apache.directory.api/api-ldap-client-all
/**
* <p>Constructs a builder for the specified object.</p>
*
* <p>If the style is <code>null</code>, the default style is used.</p>
*
* <p>If the buffer is <code>null</code>, a new one is created.</p>
*
* @param object the Object to build a <code>toString</code> for, not recommended to be null
* @param style the style of the <code>toString</code> to create, null uses the default style
* @param buffer the <code>StringBuffer</code> to populate, may be null
*/
public ToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer) {
if (style == null) {
style = getDefaultStyle();
}
if (buffer == null) {
buffer = new StringBuffer(512);
}
this.buffer = buffer;
this.style = style;
this.object = object;
style.appendStart(buffer, object);
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.lang
/**
* <p>Constructs a builder for the specified object.</p>
*
* <p>If the style is <code>null</code>, the default style is used.</p>
*
* <p>If the buffer is <code>null</code>, a new one is created.</p>
*
* @param object the Object to build a <code>toString</code> for, not recommended to be null
* @param style the style of the <code>toString</code> to create, null uses the default style
* @param buffer the <code>StringBuffer</code> to populate, may be null
*/
public ToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer) {
if (style == null) {
style = getDefaultStyle();
}
if (buffer == null) {
buffer = new StringBuffer(512);
}
this.buffer = buffer;
this.style = style;
this.object = object;
style.appendStart(buffer, object);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.commons.lang
/**
* <p>Constructs a builder for the specified object.</p>
*
* <p>If the style is <code>null</code>, the default style is used.</p>
*
* <p>If the buffer is <code>null</code>, a new one is created.</p>
*
* @param object the Object to build a <code>toString</code> for, not recommended to be null
* @param style the style of the <code>toString</code> to create, null uses the default style
* @param buffer the <code>StringBuffer</code> to populate, may be null
*/
public ToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer) {
if (style == null) {
style = getDefaultStyle();
}
if (buffer == null) {
buffer = new StringBuffer(512);
}
this.buffer = buffer;
this.style = style;
this.object = object;
style.appendStart(buffer, object);
}
代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand
/**
* <p>Constructs a builder for the specified object.</p>
*
* <p>If the style is <code>null</code>, the default style is used.</p>
*
* <p>If the buffer is <code>null</code>, a new one is created.</p>
*
* @param object the Object to build a <code>toString</code> for, not recommended to be null
* @param style the style of the <code>toString</code> to create, null uses the default style
* @param buffer the <code>StringBuffer</code> to populate, may be null
*/
public ToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer) {
if (style == null) {
style = getDefaultStyle();
}
if (buffer == null) {
buffer = new StringBuffer(512);
}
this.buffer = buffer;
this.style = style;
this.object = object;
style.appendStart(buffer, object);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* <p>Constructs a builder for the specified object.</p>
*
* <p>If the style is <code>null</code>, the default style is used.</p>
*
* <p>If the buffer is <code>null</code>, a new one is created.</p>
*
* @param object the Object to build a <code>toString</code> for, not recommended to be null
* @param style the style of the <code>toString</code> to create, null uses the default style
* @param buffer the <code>StringBuffer</code> to populate, may be null
*/
public ToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer) {
if (style == null) {
style = getDefaultStyle();
}
if (buffer == null) {
buffer = new StringBuffer(512);
}
this.buffer = buffer;
this.style = style;
this.object = object;
style.appendStart(buffer, object);
}
内容来源于网络,如有侵权,请联系作者删除!