当前位置: 首页>>代码示例>>Java>>正文


Java ToStringStyle类代码示例

本文整理汇总了Java中org.apache.commons.lang.builder.ToStringStyle的典型用法代码示例。如果您正苦于以下问题:Java ToStringStyle类的具体用法?Java ToStringStyle怎么用?Java ToStringStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ToStringStyle类属于org.apache.commons.lang.builder包,在下文中一共展示了ToStringStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCreateFilter

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
/**
 * Test create filter.
 *
 * @throws IpRangeException
 *             the ip range exception
 */
@Test
public void testCreateFilter() throws IpRangeException {
    AuthenticationTestUtils.setManagerContext();

    try {
        IpRangeFilterVO filter = ipRangeFilterManagement.createFilter(IP_FILTER_EMPTY, "", "");
        Assert.assertNotNull(filter, "got no filter");
        filter = ipRangeFilterManagement.createFilter(IP_FILTER_INCLUDING_CURRENT_IP,
                "127.0.0.1", "3.4.5.6");
        LOG.debug("filter: \n"
                + ToStringBuilder.reflectionToString(filter, ToStringStyle.MULTI_LINE_STYLE));
        filter = ipRangeFilterManagement.createFilter("IncludeFilter", "168.0.0.1", "");
        LOG.debug("filter: \n"
                + ToStringBuilder.reflectionToString(filter, ToStringStyle.MULTI_LINE_STYLE));
        filter = ipRangeFilterManagement.createFilter("IncludeFilter_2",
                "::168.0.0.1-::168.0.5.0", "");
        LOG.debug("filter: \n"
                + ToStringBuilder.reflectionToString(filter, ToStringStyle.MULTI_LINE_STYLE));
    } catch (IpRangeException e) {
        LOG.error(e + ", ip: '" + e.getIp() + "'", e);
        throw e;
    }
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:30,代码来源:IpRangeFilterManagementTest.java

示例2: findDistinctLang

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
@Override
public List<String> findDistinctLang() {
	if (this.availableLanguages == null) {
		LOG.info("Initialize available Languages.");
		List<String> locales = new ArrayList<>();
		List<MessageResource> messages = this.findAll();
		for (MessageResource resource : messages) {
			String locale = resource.getLang();
			if (!locales.contains(locale)) {
				locales.add(locale);
			}
		}
		this.availableLanguages = locales;
		LOG.info("Available locales are: " + ToStringBuilder.reflectionToString(locales, ToStringStyle.SHORT_PREFIX_STYLE));
	}
	return this.availableLanguages;
}
 
开发者ID:namics,项目名称:spring-i18n-support,代码行数:18,代码来源:SimpleJdbcMessageSourceDao.java

示例3: renderValue

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
private String renderValue(Object value) {
	String str;
	if(value == null)
		str = "null";
	else if(value.getClass().isArray()) {
		// recursive string join
		str = "[";
		for(Object o: toArray(value)) {
			str += renderValue(o) + ", ";
		}
		str = (str.length() > 1 ? str.substring(0, str.length()-2) : "") + "]";
	}
	else {
		try {
			if(value.getClass().getMethod("toString").getDeclaringClass() == Object.class) {
				str = ToStringBuilder.reflectionToString(value, ToStringStyle.SHORT_PREFIX_STYLE);
			}
			else str = value.toString();
		} catch (NoSuchMethodException e) {
			str = value.toString();
		}
	}

	return showTypes && value != null ? str + " (" + value.getClass().getName() + ")" : str;
}
 
开发者ID:jkschneider,项目名称:java-power-assert,代码行数:26,代码来源:ExpressionRenderer.java

示例4: toString

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
/**
 * 对象转字符串
 * @param obj
 * 			目标对象
 * 
 * @param style
 * 			@see org.apache.commons.lang.builder.ToStringStyle
 * 
 * @return
 */
public static String toString(Object obj, ToStringStyle style){
	if(null == obj){
		return "";
	}
	
	StringBuilder defaultObjReg = new StringBuilder();
	defaultObjReg.append("^[\\w\\.]*");
	defaultObjReg.append(obj.getClass().getSimpleName());
	defaultObjReg.append("@");
	defaultObjReg.append("[a-zA-Z0-9]+");
	defaultObjReg.append("$");
	
	// 未重写toString
	if(String.valueOf(obj).matches(defaultObjReg.toString())){
		return ReflectionToStringBuilder.toString(obj,
				style);
	}
	
	return obj.toString();
}
 
开发者ID:ls960972314,项目名称:report,代码行数:31,代码来源:ObjectUtil.java

示例5: checkTagCategoryData

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
/**
 * Checks if the given tag category entity equals to the tag category value object.
 *
 * @param expected
 *            the expected values
 * @param actual
 *            the actual values
 */
private void checkTagCategoryData(GlobalTagCategoryVO expected, GlobalTagCategory actual) {
    ToStringBuilder s1 = new ToStringBuilder(ToStringStyle.MULTI_LINE_STYLE)
            .append("description", actual.getDescription()).append("name", actual.getName())
            .append("prefix", actual.getPrefix());
    boolean result = true;
    result = result && StringUtils.equals(expected.getDescription(), actual.getDescription());
    result = result && StringUtils.equals(expected.getName(), actual.getName());
    result = result && StringUtils.equals(expected.getPrefix(), actual.getPrefix());
    Assert.assertEquals(
            result,
            true,
            "value object and entity not equal, entity: "
                    + s1.toString()
                    + ", source vo: "
                    + ToStringBuilder.reflectionToString(expected,
                            ToStringStyle.MULTI_LINE_STYLE));
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:26,代码来源:TagCategoryManagementTest.java

示例6: toString

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String toString() {
	ToStringBuilder tsb = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
	tsb.append("address", address).append("channel", channel).append("parameter", parameter);
	if (converter != null) {
		tsb.append("converter", converter);
	}
	if (action != null) {
		tsb.append("action", action);
	}
	if (forceUpdate) {
		tsb.append("forceUpdate", forceUpdate);
	}
	if (delay > 0.0) {
		tsb.append("delay", delay);
	}
	return tsb.toString();
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:22,代码来源:DatapointConfig.java

示例7: toString

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
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("usernameAttribute", this.usernameAttribute);
    toStringBuilder.append("attributes", this.allowedAttributes.toArray());

    return toStringBuilder.toString();
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:12,代码来源:AbstractRegisteredService.java

示例8: find

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
@Override
public Rule find(RuleQuery query) {
  Collection<Rule> all = findAll(query);
  if (all.size() > 1) {
    throw new IllegalArgumentException("Non unique result for rule query: " + ReflectionToStringBuilder.toString(query, ToStringStyle.SHORT_PREFIX_STYLE));
  } else if (all.isEmpty()) {
    return null;
  } else {
    return all.iterator().next();
  }
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:12,代码来源:RuleFinderCompatibility.java

示例9: parseContentBodyRow

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
/**
 * Method parses a row of the body content and puts the related entry into the result list (entries).
 * If the row is invalid in any kind, no modification happens. If any of the parameters provided is null or invalid,
 * no modification happens.
 * 
 * @param entries the list of entries, where the result of the row should be put in
 * @param langKeys the language information to parse the row correctly
 * @param row the row to be processed.
 */
private void parseContentBodyRow(	List<MessageResourceEntry> entries,
									Map<Integer, Locale> langKeys,
									Row row,
									String type)
{
	if (entries == null || row == null || langKeys == null || langKeys.isEmpty())
	{
		return;
	}
	MessageResourceEntry entry = new MessageResourceEntry();
	String code = getCellStringValue(row.getCell(this.keyColumn));
	if (!StringUtils.isBlank(code))
	{
		entry.setCodeId(StringUtils.trim(code));
		for (int nameIndex = this.firstLanguageColumn; nameIndex <= langKeys.size(); nameIndex++)
		{
			Cell cell = row.getCell(nameIndex);
			String name = getCellStringValue(cell);
			if (!StringUtils.isBlank(name))
			{
				Locale lang = langKeys.get(nameIndex);
				entry.addLang(lang, name);
			}
		}
		if (entry.size() > 0)
		{
			entry.setType(type);
			entries.add(entry);
		}
	}
	if (LOG.isDebugEnabled())
	{
		LOG.debug(ToStringBuilder.reflectionToString(entry, ToStringStyle.SHORT_PREFIX_STYLE));
	}
}
 
开发者ID:namics,项目名称:spring-i18n-support,代码行数:45,代码来源:ExcelReader.java

示例10: getLanguageInformation

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
/**
 * Extracts the language information form the data.
 * This method iterates all MessagaResourceEntries to get all available languages used in the data.
 * 
 * @param entries the entries to extract the used langs
 * @return the Map to map a certain language to a special column in the process of content row writing
 */
private Map<Locale, Integer> getLanguageInformation(List<MessageResourceEntry> entries)
{
	LOG.info("Extract language information");
	SortedSet<Locale> locales = new TreeSet<Locale>(new LocaleComparator());
	for (MessageResourceEntry entry : entries)
	{
		Map<Locale, String> mappings = entry.getNameMappings();
		if (mappings != null && !mappings.isEmpty())
		{
			for (Locale key : mappings.keySet())
			{
				locales.add(key);
			}
		}
	}
	Map<Locale, Integer> result = new HashMap<Locale, Integer>();
	int colIndex = this.firstLanguageColumn; // calculate the index column for new languages
	for (Locale locale : locales)
	{
		result.put(locale, colIndex);
		colIndex++;
	}
	if (LOG.isDebugEnabled())
	{
		LOG.debug("Extracted languages " + ToStringBuilder.reflectionToString(result, ToStringStyle.SHORT_PREFIX_STYLE));
	}
	return result;
}
 
开发者ID:namics,项目名称:spring-i18n-support,代码行数:36,代码来源:ExcelWriter.java

示例11: toString

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
public String toString() {
	return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
			.append("PostId", getPostId())
			.append("PostName", getPostName())
			.append("Remark", getRemark())
			.append("PostType", getPostType())
			.append("ParentPostid", getParentPostid()).toString();
}
 
开发者ID:zhangjunfang,项目名称:jta-atomikos,代码行数:9,代码来源:TsysPost.java

示例12: toString

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
public String toString() {
	return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
		.append("AppId",getAppId())
		.append("AppName",getAppName())
		.append("AppIcon",getAppIcon())
		.append("OrderNo",getOrderNo())
		.append("AppPath",getAppPath())
		.append("AppShortname",getAppShortname())
		.toString();
}
 
开发者ID:zhangjunfang,项目名称:jta-atomikos,代码行数:11,代码来源:TsysApp.java

示例13: toStringBuilder

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
protected ToStringBuilder toStringBuilder() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append(this.getSchema())
            .append(this.getChangeName())
            .append(this.getObjectName())
            .append(this.getChangeType())
            .append(this.getContent())
            .append(this.getContentHash())
            .append(this.getOrderWithinObject())
            ;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:12,代码来源:Change.java

示例14: toString

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("username", getUsername())
            .append("userId", userId)
            .append("role", role)
            .toString();
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:9,代码来源:UserInfo.java

示例15: toString

import org.apache.commons.lang.builder.ToStringStyle; //导入依赖的package包/类
@Override
public String toString() {
    if (this.messageType == Constants.MESSAGE_TYPE_SERVICE) {
        return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("serialize", serialize)
                .append("seq", seq).append("messageType", messageType).toString();
    } else {
        return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("serialize", serialize)
                .append("seq", seq).append("messageType", messageType).append("return", returnVal).toString();
    }
}
 
开发者ID:justimkiss,项目名称:bee,代码行数:11,代码来源:DefaultResponse.java


注:本文中的org.apache.commons.lang.builder.ToStringStyle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。