Java Code Examples for org.apache.commons.lang3.builder.ToStringStyle

The following are top voted examples for showing how to use org.apache.commons.lang3.builder.ToStringStyle. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: springboot-shiro-cas-mybatis   File: AbstractRegisteredService.java   7 votes vote down vote up
@Override
public String toString() {
    final ToStringBuilder toStringBuilder = new ToStringBuilder(null, ToStringStyle.SHORT_PREFIX_STYLE);
    toStringBuilder.append("id", this.id);
    toStringBuilder.append("name", this.name);
    toStringBuilder.append("description", this.description);
    toStringBuilder.append("serviceId", this.serviceId);
    toStringBuilder.append("usernameAttributeProvider", this.usernameAttributeProvider);
    toStringBuilder.append("theme", this.theme);
    toStringBuilder.append("evaluationOrder", this.evaluationOrder);
    toStringBuilder.append("logoutType", this.logoutType);
    toStringBuilder.append("attributeReleasePolicy", this.attributeReleasePolicy);
    toStringBuilder.append("accessStrategy", this.accessStrategy);
    toStringBuilder.append("publicKey", this.publicKey);
    toStringBuilder.append("proxyPolicy", this.proxyPolicy);
    toStringBuilder.append("logo", this.logo);
    toStringBuilder.append("logoutUrl", this.logoutUrl);
    toStringBuilder.append("requiredHandlers", this.requiredHandlers);
    toStringBuilder.append("properties", this.properties);

    return toStringBuilder.toString();
}
 
Example 2
Project: springboot-shiro-cas-mybatis   File: ShiroRealm.java   6 votes vote down vote up
@Override
	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
		//UsernamePasswordToken对象用来存放提交的登录信息
        UsernamePasswordToken token=(UsernamePasswordToken) authenticationToken;

        log.info("验证当前Subject时获取到token为:" + ReflectionToStringBuilder.toString(token, ToStringStyle.MULTI_LINE_STYLE)); 
//        return new SimpleAuthenticationInfo("hsjhsj","8e24137dee97c9bbddb9a0cd6e043be4" , getName());
        return new SimpleAuthenticationInfo("hsjhsj","" , getName());
        //查出是否有此用户
//        TbUser user=null;
//        if(user!=null){
            // 若存在,将此用户存放到登录认证info中,无需自己做密码对比,Shiro会为我们进行密码对比校验
//            return new SimpleAuthenticationInfo(user.getUsername(), , getName());
//        }
//        return null;
	}
 
Example 3
Project: cas-5.1.0   File: WsFederationCredential.java   6 votes vote down vote up
/**
 * toString produces a human readable representation of the WsFederationCredential.
 *
 * @return a human readable representation of the WsFederationCredential
 */
@Override
public String toString() {

    return new ToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE)
            .append("ID", this.id)
            .append("Issuer", this.issuer)
            .append("Audience", this.audience)
            .append("Authentication Method", this.authenticationMethod)
            .append("Issued On", this.issuedOn)
            .append("Valid After", this.notBefore)
            .append("Valid Before", this.notOnOrAfter)
            .append("Attributes", this.attributes)
            .build();

}
 
Example 4
Project: cas-5.1.0   File: AbstractRegisteredService.java   6 votes vote down vote up
@Override
public String toString() {
    final ToStringBuilder toStringBuilder = new ToStringBuilder(null, ToStringStyle.SHORT_PREFIX_STYLE);
    toStringBuilder.append("id", this.id);
    toStringBuilder.append("name", this.name);
    toStringBuilder.append("description", this.description);
    toStringBuilder.append("serviceId", this.serviceId);
    toStringBuilder.append("usernameAttributeProvider", this.usernameAttributeProvider);
    toStringBuilder.append("theme", this.theme);
    toStringBuilder.append("evaluationOrder", this.evaluationOrder);
    toStringBuilder.append("logoutType", this.logoutType);
    toStringBuilder.append("attributeReleasePolicy", this.attributeReleasePolicy);
    toStringBuilder.append("accessStrategy", this.accessStrategy);
    toStringBuilder.append("publicKey", this.publicKey);
    toStringBuilder.append("proxyPolicy", this.proxyPolicy);
    toStringBuilder.append("logo", this.logo);
    toStringBuilder.append("logoutUrl", this.logoutUrl);
    toStringBuilder.append("requiredHandlers", this.requiredHandlers);
    toStringBuilder.append("properties", this.properties);
    toStringBuilder.append("multifactorPolicy", this.multifactorPolicy);
    toStringBuilder.append("informationUrl", this.informationUrl);
    toStringBuilder.append("privacyUrl", this.privacyUrl);
    return toStringBuilder.toString();
}
 
Example 5
Project: obevo   File: FieldCompareBreak.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("compareSubject", getCompareSubject())
            .append("fieldName", this.fieldName)
            .append("leftVal", this.leftVal)
            .append("rightVal", this.rightVal)
            .append("leftObjectDetail", this.left)
            .append("rightObjectDetail", this.right)
            .toString();
}
 
Example 6
Project: cas-5.1.0   File: CasConfigurationDeletedEvent.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
            .appendSuper(super.toString())
            .append("file", file)
            .toString();
}
 
Example 7
Project: uroborosql   File: AuditLogSqlFilter.java   5 votes vote down vote up
@Override
public int[] doBatch(final SqlContext sqlContext, final PreparedStatement preparedStatement, final int[] result) {
	String userName = getParam(sqlContext, USER_NAME_KEY);
	if (userName == null) {
		// ユーザ名が設定されていない時
		userName = DEFAULT_USER_NAME;
	}

	String funcId = getParam(sqlContext, FUNC_ID_KEY);
	if (funcId == null) {
		// 機能IDが設定されていない時
		funcId = DEFAULT_FUNC_ID;
	}
	int rowCount = -1;
	if (LOG.isDebugEnabled()) {
		try {
			rowCount = preparedStatement.getUpdateCount();
		} catch (SQLException ex) {
			// ここでの例外は実処理に影響を及ぼさないよう握りつぶす
		}
	}
	LOG.debug(ToStringBuilder.reflectionToString(
			new AuditData(userName, funcId, sqlContext.getSqlId(), sqlContext.getSqlName(), sqlContext
					.getExecutableSql(), rowCount), ToStringStyle.JSON_STYLE));

	return result;
}
 
Example 8
Project: wurmloch-crdt   File: USet.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .appendSuper(super.toString())
            .append("crdtId", getCrdtId())
            .append("element", element)
            .toString();
}
 
Example 9
Project: mybatis-generator-tool   File: CommentPlugin.java   5 votes vote down vote up
@Override
public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    Method method = new Method("toString");
    method.setReturnType(new FullyQualifiedJavaType(String.class.getCanonicalName()));
    method.setVisibility(JavaVisibility.PUBLIC);
    method.addAnnotation("@Override");
    method.addBodyLine("return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);");
    topLevelClass.addImportedType(new FullyQualifiedJavaType(ToStringBuilder.class.getCanonicalName()));
    topLevelClass.addImportedType(new FullyQualifiedJavaType(ToStringStyle.class.getCanonicalName()));
    topLevelClass.addMethod(method);
    return topLevelClassComment(topLevelClass, introspectedTable, true);
}
 
Example 10
Project: mid-tier   File: Event.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("id", id)
            .append("sequence", sequence)
            .append("time", time)
            .append("origin", origin)
            .append("information", information)
            .toString();
}
 
Example 11
Project: wurmloch-crdt   File: ORSet.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .appendSuper(super.toString())
            .append("crdtId", getCrdtId())
            .append("element", element)
            .toString();
}
 
Example 12
Project: obevo   File: ObjectCompareBreak.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("objectCompareBreakSide", objectCompareBreakSide)
            .append("compareSubject", getCompareSubject())
            .toString();
}
 
Example 13
Project: mid-tier   File: Event.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("id", id)
            .append("sequence", sequence)
            .append("time", time)
            .append("origin", origin)
            .append("information", information)
            .toString();
}
 
Example 14
Project: obevo   File: DaPackagePojoImpl.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("name", name)
            .append("schema", schema)
            .toString();
}
 
Example 15
Project: openshift-ldapsync   File: User.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("dn", dn)
            .append("userName", userName)
            .append("fullName", fullName)
            .append("email", email)
            .toString();
}
 
Example 16
Project: yadaframework   File: YadaRegistrationRequest.java   5 votes vote down vote up
@Override
public String toString() {
	return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).
       append("email", email).
       append("timestamp", timestamp).
       append("token", token).
       toString();
}
 
Example 17
Project: wurmloch-crdt   File: USet.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .appendSuper(super.toString())
            .append("crdtId", getCrdtId())
            .append("element", element)
            .toString();
}
 
Example 18
Project: java-rest-books   File: Author.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("firstName", firstName)
            .append("lastName", lastName)
            .toString();
}
 
Example 19
Project: java-rest-books   File: Book.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("id", id)
            .append("isbn", isbn)
            .append("title", title)
            .append("description", description)
            .append("authors", authors)
            .append("publisher", publisher)
            .toString();
}
 
Example 20
Project: wurmloch-crdt   File: PNCounter.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .appendSuper(super.toString())
            .append("pEntries", pEntries)
            .append("nEntries", nEntries)
            .toString();
}
 
Example 21
Project: uroborosql   File: IfNode.java   5 votes vote down vote up
/**
 * ExpressionのNodeを解析してパラメータの値をダンプします
 *
 * @param node expressionの各ノード
 * @param transformContext
 * @param builder パラメータの値を出力する先
 */
private void dumpNode(final Node node, final TransformContext transformContext, final StringBuilder builder) {
	if (node == null) {
		return;
	}
	if (node instanceof ASTProperty) {
		ASTProperty prop = (ASTProperty) node;
		if (!StringFunction.SHORT_NAME.equals(prop.toString())) {
			try {
				Object value = Ognl.getValue(prop, transformContext);
				builder.append(prop)
						.append(":[")
						.append(value == null ? null : ToStringBuilder.reflectionToString(value,
								ToStringStyle.SIMPLE_STYLE))
						.append("],");
			} catch (OgnlException ex) {
				// ダンプ処理でシステムが止まっては困るのでスタックトレースを出して握りつぶす
				ex.printStackTrace();
			}
		}
	} else {
		int childCount = node.jjtGetNumChildren();
		for (int i = 0; i < childCount; i++) {
			Node child = node.jjtGetChild(i);
			dumpNode(child, transformContext, builder);
		}
	}
}
 
Example 22
Project: datax   File: RangeSplitUtilTest.java   5 votes vote down vote up
@Test
    public void testDoAsciiStringSplit() {
//        String left = "adde";
//        String right = "xyz";
//        int expectSliceNumber = 4;
        String left = "a";
        String right = "z";
        int expectSliceNumber = 3;

        String[] result = RangeSplitUtil.doAsciiStringSplit(left, right, expectSliceNumber);
        System.out.println(ToStringBuilder.reflectionToString(result, ToStringStyle.SIMPLE_STYLE));

    }
 
Example 23
Project: wurmloch-crdt   File: CrdtDefinition.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("crdtId", crdtId)
            .append("crdtClass", crdtClass)
            .toString();
}
 
Example 24
Project: mid-tier   File: Event.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("id", id)
            .append("sequence", sequence)
            .append("time", time)
            .append("origin", origin)
            .append("information", information)
            .toString();
}
 
Example 25
Project: sponge   File: MidiMetaMessageEvent.java   5 votes vote down vote up
@Override
public String getMessageString() {
    //@formatter:off
    return new ToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE)
            .append("category", getCategory().getCode())
            .append(ATTR_MESSAGE_TYPE, getMessageType())
            .append(ATTR_DATA, Hex.encodeHex(getData()))
            .append(ATTR_TIME_STAMP, getTimeStamp())
            .toString();
    //@formatter:on
}
 
Example 26
Project: wurmloch-crdt   File: GCounter.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .appendSuper(super.toString())
            .append("entries", entries)
            .toString();
}
 
Example 27
Project: wurmloch-crdt   File: TwoPSet.java   5 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .appendSuper(super.toString())
            .append("crdtId", getCrdtId())
            .append("element", element)
            .toString();
}
 
Example 28
Project: eds   File: LogicConsumerConfig.java   4 votes vote down vote up
@Override
public String toString() {
  return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
}
 
Example 29
Project: athena   File: GetAllActiveAlarms.java   4 votes vote down vote up
void printAlarms(Set<Alarm> alarms) {
    alarms.stream().forEach((alarm) -> {
        print(ToStringBuilder.reflectionToString(alarm, ToStringStyle.SHORT_PREFIX_STYLE));
    });
}
 
Example 30
Project: take   File: BaseModel.java   4 votes vote down vote up
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
 
Example 31
Project: uroborosql   File: SqlAgentSampleTest.java   4 votes vote down vote up
private String toString(final List<Map<String, Object>> obj) {
	return ToStringBuilder.reflectionToString(obj, ToStringStyle.SHORT_PREFIX_STYLE);
}
 
Example 32
Project: Homework   File: JDBCTest4.java   4 votes vote down vote up
@Override
public String toString()
{
	return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
 
Example 33
Project: obevo   File: DaColumnReferenceImpl.java   4 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("fkColumnReference", fkColumnReference)
            .toString();
}
 
Example 34
Project: obevo   File: DaColumnImpl.java   4 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("column", column)
            .toString();
}
 
Example 35
Project: OpenLRW   File: MongoCourse.java   4 votes vote down vote up
@Override
public String toString() {
  return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
 
Example 36
Project: OperatieBRP   File: BrpFamilierechtelijkeBetrekkingInhoud.java   4 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).appendSuper(super.toString())
            .append("datumFamilierechtelijkeBetrekking", datumFamilierechtelijkeBetrekking)
            .toString();
}
 
Example 37
Project: Homework   File: MasterManager.java   4 votes vote down vote up
@Override
public String toString()
{
	return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
 
Example 38
Project: OpenLRW   File: MongoClass.java   4 votes vote down vote up
@Override
public String toString() {
  return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
 
Example 39
Project: golos4j   File: GetDynamicGlobalPropertiesDto.java   4 votes vote down vote up
@Override
public String toString() {
	return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
 
Example 40
Project: cas-5.1.0   File: LoggingConfigController.java   4 votes vote down vote up
/**
 * Gets configuration as JSON.
 * Depends on the log4j core API.
 *
 * @param request  the request
 * @param response the response
 * @return the configuration
 * @throws Exception the exception
 */
@GetMapping(value = "/getConfiguration")
@ResponseBody
public Map<String, Object> getConfiguration(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
    ensureEndpointAccessIsAuthorized(request, response);

    Assert.notNull(this.loggerContext);

    final Collection<Map<String, Object>> configuredLoggers = new HashSet<>();
    getLoggerConfigurations().forEach(config -> {
        final Map<String, Object> loggerMap = new HashMap<>();
        loggerMap.put("name", StringUtils.defaultIfBlank(config.getName(), LOGGER_NAME_ROOT));
        loggerMap.put("state", config.getState());
        if (config.getProperties() != null) {
            loggerMap.put("properties", config.getProperties());
        }
        loggerMap.put("additive", config.isAdditive());
        loggerMap.put("level", config.getLevel().name());
        final Collection<String> appenders = new HashSet<>();
        config.getAppenders().keySet().stream().map(key -> config.getAppenders().get(key)).forEach(appender -> {
            final ToStringBuilder 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);
    });
    final Map<String, Object> responseMap = new HashMap<>();
    responseMap.put("loggers", configuredLoggers);
    return responseMap;
}
 
Example 41
Project: cas-5.1.0   File: AuthenticationRiskContingencyResponse.java   4 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE)
            .append("result", result.getId())
            .toString();
}
 
Example 42
Project: cas-5.1.0   File: AuthenticationRiskScore.java   4 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE)
            .append("score", score)
            .toString();
}
 
Example 43
Project: CityPower-Build-Sample   File: ApplicationProperties.java   4 votes vote down vote up
@Override
public String toString() {
	return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
}
 
Example 44
Project: Homework   File: JDBCEx05.java   4 votes vote down vote up
@Override
public String toString()
{
	return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
 
Example 45
Project: golos4j   File: GetAccountCountDto.java   4 votes vote down vote up
@Override
public String toString() {
	return ToStringBuilder.reflectionToString(this,
			ToStringStyle.SHORT_PREFIX_STYLE);
}
 
Example 46
Project: cas-5.1.0   File: U2FTokenCredential.java   4 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.NO_CLASS_NAME_STYLE)
            .append("token", this.token)
            .toString();
}
 
Example 47
Project: CityPower-Build-Sample   File: ApplicationProperties.java   4 votes vote down vote up
@Override
public String toString() {
	return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
}
 
Example 48
Project: cas-5.1.0   File: PrincipalAttributeRegisteredServiceUsernameProvider.java   4 votes vote down vote up
@Override
public String toString() {
    final ToStringBuilder toStringBuilder = new ToStringBuilder(null, ToStringStyle.SHORT_PREFIX_STYLE);
    toStringBuilder.append("usernameAttribute", this.usernameAttribute);
    return toStringBuilder.toString();
}
 
Example 49
Project: indy-sdk-java   File: SovrinJava.java   4 votes vote down vote up
@Override
public String toString() {

	return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
 
Example 50
Project: solo-spring   File: HTTPResponse.java   4 votes vote down vote up
@Override
public String toString() {
	return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
 
Example 51
Project: tutorials   File: TuermeVonHanoi.java   4 votes vote down vote up
@Override
public String toString() {
  return ToStringBuilder.reflectionToString(stapel, ToStringStyle.SIMPLE_STYLE);
}
 
Example 52
Project: Homework   File: IOex01.java   4 votes vote down vote up
@Override
public String toString()
{
	return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
 
Example 53
Project: golos4j   File: VoteDto.java   4 votes vote down vote up
@Override
public String toString() {
	return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
 
Example 54
Project: diorite-configs-java8   File: ConfigTest.java   4 votes vote down vote up
@Test
public void test() throws Exception
{
    SerializationTest.prepareSerialization();
    ToStringBuilder.setDefaultStyle(ToStringStyle.SHORT_PREFIX_STYLE);


    ConfigTemplate<SomeConfig> configTemplate = this.configManager.getConfigFile(SomeConfig.class);
    Assert.assertNotNull(configTemplate);
    Assert.assertEquals(SomeConfig.class.getSimpleName(), configTemplate.getName());
    Assert.assertEquals(StandardCharsets.UTF_8, configTemplate.getDefaultDecoder().charset());
    Assert.assertEquals(StandardCharsets.UTF_8, configTemplate.getDefaultEncoder().charset());

    System.out.println("[ConfigTest] creating config instance.");
    SomeConfig someConfig = configTemplate.create();
    Assert.assertNotNull(someConfig);

    Assert.assertNull(someConfig.metadata().get("meta"));
    Assert.assertEquals("1", someConfig.getSomething());
    Assert.assertNull(someConfig.get("something"));
    Assert.assertEquals("meta value", someConfig.metadata().get("meta"));

    Assert.assertNotNull(someConfig.getEnumValue());
    someConfig.setEnumValue(TestEnum.C);
    Assert.assertSame(TestEnum.C, someConfig.getEnumValue());
    this.testNicknames(someConfig);
    Assert.assertNotNull(someConfig.getSpecialData());
    someConfig.setStorage(SerializationTest.prepareObject());

    someConfig.save(System.out);

    try
    {
        someConfig.getSpecialData().clear();
        Assert.assertTrue("This should never happen, special data should be immutable.", false);
    }
    catch (UnsupportedOperationException e)
    {
    }
    MetaObject snowflake = new MetaObject("snowflake", new MetaValue("so special", 25));
    someConfig.putInSpecialData(snowflake);
    Assert.assertEquals(ImmutableList.of(snowflake), someConfig.getSpecialData());

    UUID randomUUID = UUID.randomUUID();
    someConfig.putInEvenMoreSpecialData(randomUUID, snowflake);
    Assert.assertEquals(1, someConfig.getEvenMoreSpecialData().size());

    System.out.println("\n====================\n");
    someConfig.save(System.out);

    Assert.assertEquals(snowflake, someConfig.removeFromEvenMoreSpecialData(randomUUID));
    Assert.assertTrue(someConfig.getEvenMoreSpecialData().isEmpty());
    someConfig.putInEvenMoreSpecialData(randomUUID, snowflake);
    Assert.assertEquals(1, someConfig.getEvenMoreSpecialData().size());

    Assert.assertTrue(someConfig.removeFromEvenMoreSpecialDataIf((key, value) -> key.equals(randomUUID)));
    Assert.assertTrue(someConfig.getEvenMoreSpecialData().isEmpty());
    someConfig.putInEvenMoreSpecialData(randomUUID, snowflake);
    Assert.assertEquals(1, someConfig.getEvenMoreSpecialData().size());

    Assert.assertTrue(someConfig.removeFromEvenMoreSpecialDataIf((key, value) -> value.equals(snowflake)));
    Assert.assertTrue(someConfig.getEvenMoreSpecialData().isEmpty());
    someConfig.putInEvenMoreSpecialData(randomUUID, snowflake);
    Assert.assertEquals(1, someConfig.getEvenMoreSpecialData().size());

    Assert.assertTrue(someConfig.removeFromEvenMoreSpecialDataIf((entry) -> entry.getValue().equals(snowflake)));
    Assert.assertTrue(someConfig.getEvenMoreSpecialData().isEmpty());
    someConfig.putInEvenMoreSpecialData(randomUUID, snowflake);
    Assert.assertEquals(1, someConfig.getEvenMoreSpecialData().size());

    someConfig.putInEvenMoreSpecialData(randomUUID, snowflake);
    Assert.assertEquals(1, someConfig.getEvenMoreSpecialData().size());


    // check if all data is still valid after reload of config.
    StringBuilderWriter writer = new StringBuilderWriter(500);
    someConfig.save(writer);
    Assert.assertEquals(someConfig, configTemplate.load(new StringReader(writer.toString())));
}
 
Example 55
Project: spring-rest-commons-options   File: Resource.java   4 votes vote down vote up
@Override
public String toString() {
	return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
}
 
Example 56
Project: obevo   File: DaTableImpl.java   4 votes vote down vote up
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("table", table)
            .toString();
}
 
Example 57
Project: OpenLRW   File: DataSync.java   4 votes vote down vote up
@Override
public String toString() {
  return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
 
Example 58
Project: OperatieBRP   File: AdministratieveHandeling.java   4 votes vote down vote up
@Override
public final String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).appendSuper(super.toString()).append("id", id).append("soort", getSoort())
            .toString();
}
 
Example 59
Project: citizen-sdk-android   File: Token.java   4 votes vote down vote up
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
 
Example 60
Project: rocketmq-rocketmq-all-4.1.0-incubating   File: ConsumerFilterData.java   4 votes vote down vote up
@Override
public String toString() {
    return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}