use of org.apache.commons.lang3.builder.ToStringBuilder in project commons-lang by apache.
the class NoClassNameToStringStyleTest method testPerson.
@Test
public void testPerson() {
final Person p = new Person();
p.name = "John Q. Public";
p.age = 45;
p.smoker = true;
assertEquals("[name=John Q. Public,age=45,smoker=true]", new ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).toString());
}
use of org.apache.commons.lang3.builder.ToStringBuilder in project cloudstack by apache.
the class MailAddress method toString.
@Override
public String toString() {
ToStringBuilder tsb = new ToStringBuilder(this, ToStringStyle.JSON_STYLE);
tsb.append("mailAddress", address);
return tsb.build();
}
use of org.apache.commons.lang3.builder.ToStringBuilder in project cas by apereo.
the class LoggingConfigurationEndpoint method configuration.
/**
* Configuration map.
*
* @return the map
*/
@ReadOperation
@Operation(summary = "Get logging configuration report")
public Map<String, Object> configuration() {
val configuredLoggers = new HashSet<>();
getLoggerConfigurations().forEach(config -> {
val loggerMap = new HashMap<String, Object>();
loggerMap.put("name", StringUtils.defaultIfBlank(config.getName(), LOGGER_NAME_ROOT));
loggerMap.put("state", config.getState());
if (config.getPropertyList() != null) {
loggerMap.put("properties", config.getPropertyList());
}
loggerMap.put("additive", config.isAdditive());
loggerMap.put("level", config.getLevel().name());
val appenders = new HashSet<>();
config.getAppenders().keySet().stream().map(key -> config.getAppenders().get(key)).forEach(appender -> {
val builder = new ToStringBuilder(this, ToStringStyle.JSON_STYLE);
builder.append("name", appender.getName());
builder.append("state", appender.getState());
builder.append("layoutFormat", appender.getLayout().getContentFormat());
builder.append("layoutContentType", appender.getLayout().getContentType());
if (appender instanceof FileAppender) {
builder.append(FILE_PARAM, ((FileAppender) appender).getFileName());
builder.append(FILE_PATTERN_PARAM, "(none)");
}
if (appender instanceof RandomAccessFileAppender) {
builder.append(FILE_PARAM, ((RandomAccessFileAppender) appender).getFileName());
builder.append(FILE_PATTERN_PARAM, "(none)");
}
if (appender instanceof RollingFileAppender) {
builder.append(FILE_PARAM, ((RollingFileAppender) appender).getFileName());
builder.append(FILE_PATTERN_PARAM, ((RollingFileAppender) appender).getFilePattern());
}
if (appender instanceof MemoryMappedFileAppender) {
builder.append(FILE_PARAM, ((MemoryMappedFileAppender) appender).getFileName());
builder.append(FILE_PATTERN_PARAM, "(none)");
}
if (appender instanceof RollingRandomAccessFileAppender) {
builder.append(FILE_PARAM, ((RollingRandomAccessFileAppender) appender).getFileName());
builder.append(FILE_PATTERN_PARAM, ((RollingRandomAccessFileAppender) appender).getFilePattern());
}
appenders.add(builder.build());
});
loggerMap.put("appenders", appenders);
configuredLoggers.add(loggerMap);
});
val responseMap = new HashMap<String, Object>();
responseMap.put("loggers", configuredLoggers);
val loggers = getActiveLoggersInFactory();
responseMap.put("activeLoggers", loggers.values());
return responseMap;
}
use of org.apache.commons.lang3.builder.ToStringBuilder in project knime-core by knime.
the class ExternalParameterHandle method toString.
@Override
public String toString() {
ToStringBuilder builder = new ToStringBuilder(this);
builder.append("parameterNameShort", m_parameterNameShort);
builder.append("parameterNameFullyQualified", m_parameterNameFullyQualified);
builder.append("ownerNodeContainer", m_ownerNodeContainer);
builder.append("parameterValue", m_parameterValue);
return builder.build();
}
use of org.apache.commons.lang3.builder.ToStringBuilder in project iaf by ibissource.
the class JndiBase method toString.
public String toString() {
ToStringBuilder ts = new ToStringBuilder(this);
ts.append("context", context);
ts.append("authentication", authentication);
ts.append("credentials", credentials);
ts.append("providerURL", providerURL);
ts.append("urlPkgPrefixes", urlPkgPrefixes);
ts.append("securityProtocol", securityProtocol);
ts.append("initialContextFactoryName", initialContextFactoryName);
return ts.toString();
}
Aggregations