use of org.apache.commons.lang3.builder.ToStringBuilder in project cas by apereo.
the class AccessTokenGrantRequestAuditResourceResolver method resolveFrom.
@Override
public String[] resolveFrom(final JoinPoint auditableTarget, final Object retval) {
Objects.requireNonNull(retval, "AccessTokenRequestDataHolder must not be null");
final AccessTokenRequestDataHolder accessTokenRequest = AccessTokenRequestDataHolder.class.cast(retval);
final String tokenId = accessTokenRequest.getToken() == null ? "N/A" : accessTokenRequest.getToken().getId();
final String result = new ToStringBuilder(this, NO_CLASS_NAME_STYLE).append("oauth_token", tokenId).append("client_id", accessTokenRequest.getRegisteredService().getClientId()).append("client_service", accessTokenRequest.getService().getId()).append("grant_type", accessTokenRequest.getGrantType().getType()).append("scopes", accessTokenRequest.getScopes()).toString();
return new String[] { result };
}
use of org.apache.commons.lang3.builder.ToStringBuilder in project commons-lang by apache.
the class JsonToStringStyleTest method testArray.
@Test
public void testArray() {
final Person p = new Person();
p.name = "Jane Doe";
p.age = 25;
p.smoker = true;
assertEquals("{\"name\":\"Jane Doe\",\"age\":25,\"smoker\":true,\"groups\":['admin', 'manager', 'user']}", new ToStringBuilder(p).append("name", p.name).append("age", p.age).append("smoker", p.smoker).append("groups", new Object() {
@Override
public String toString() {
return "['admin', 'manager', 'user']";
}
}).toString());
}
use of org.apache.commons.lang3.builder.ToStringBuilder in project commons-lang by apache.
the class JsonToStringStyleTest method testPerson.
@Test
public void testPerson() {
final Person p = new Person();
p.name = "Jane Doe";
p.age = 25;
p.smoker = true;
assertEquals("{\"name\":\"Jane Doe\",\"age\":25,\"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 commons-lang by apache.
the class SimpleToStringStyleTest method testPerson.
@Test
public void testPerson() {
final Person p = new Person();
p.name = "Jane Q. Public";
p.age = 47;
p.smoker = false;
assertEquals("Jane Q. Public,47,false", 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 xwiki-platform by xwiki.
the class AbstractMailQueueItem method prepareToString.
protected ToStringBuilder prepareToString() {
ToStringBuilder builder = new XWikiToStringBuilder(this);
builder.append("batchId", getBatchId());
return builder;
}
Aggregations