Package com.alibaba.citrus.util

Examples of com.alibaba.citrus.util.ToStringBuilder$MapBuilder


                throw new ConfigurationPointException("Invalid schema name: " + resource);
            }
        }

        if (!resources.isEmpty() && log.isDebugEnabled()) {
            ToStringBuilder buf = new ToStringBuilder();

            buf.format("Found %d versioned schema files for contribution %s:", resources.size(), mainName);
            buf.append(resources);

            log.debug(buf.toString());
        }

        return schemas.toArray(new Schema[schemas.size()]);
    }
View Full Code Here


        return sourceInfo.getLineNumber();
    }

    @Override
    public String toString() {
        ToStringBuilder buf = new ToStringBuilder();

        buf.format("Contribution[toConfigurationPoint=%s, name=%s, type=%s, class=%s]",
                   getConfigurationPoint().getName(), getName(), getType(), implementationClassName).start();

        buf.append(getSchemas());

        return buf.end().toString();
    }
View Full Code Here

        assertSame(helper, request.getAttribute("_webx_errorHandlerHelper_"));
    }

    @Test
    public void messages() {
        System.out.println(new ToStringBuilder().append(ErrorHandlerHelper.STATUS_CODE_MESSAGES));

        assertEquals("OK", ErrorHandlerHelper.STATUS_CODE_MESSAGES.get(200));
        assertEquals("BAD_REQUEST", ErrorHandlerHelper.STATUS_CODE_MESSAGES.get(400));
        assertEquals("NOT_FOUND", ErrorHandlerHelper.STATUS_CODE_MESSAGES.get(404));
        assertEquals("INTERNAL_SERVER_ERROR", ErrorHandlerHelper.STATUS_CODE_MESSAGES.get(500));
View Full Code Here

        }

        // 如果失败,记录日志
        if (attrs.isEmpty() && encoderExceptions != null) {
            if (log.isWarnEnabled()) {
                ToStringBuilder buf = new ToStringBuilder();

                buf.append("Failed to decode cookie value: ").append(cookieValue);

                int i = 0;
                for (Exception e : encoderExceptions) {
                    buf.format("\n  Encoder #%d - %s threw %s", i + 1, encoders[i].getClass().getSimpleName(), e);
                }

                log.warn(buf.toString());
            }
        } else {
            if (log.isDebugEnabled()) {
                int attrCount = attrs.size();
                ToStringBuilder buf = new ToStringBuilder();

                buf.format("Found %d attributes:", attrCount);

                if (!attrs.isEmpty()) {
                    buf.append(new MapBuilder().setPrintCount(true).setSortKeys(true).appendAll(attrs));
                }

                log.debug(buf.toString());
            }
        }

        return attrs;
    }
View Full Code Here

        // 排序cookie。
        Collections.sort(cookiesInfo.cookieList);

        if (log.isDebugEnabled()) {
            ToStringBuilder buf = new ToStringBuilder();

            buf.format("[%s] Loading cookies: %d cookies found", getStoreName(), cookiesInfo.cookieList.size());

            if (isEmptyArray(cookiesInfo.checksumList)) {
                if (checksum) {
                    buf.append("\n No checksum cookie");
                }
            } else {
                buf.format("\n %s[expected cookies=%d]=%s", checksumName, cookiesInfo.checksumList.length,
                           ObjectUtil.toString(cookiesInfo.checksumList));
            }

            for (CookieInfo cookieInfo : cookiesInfo.cookieList) {
                int length = 0;

                if (cookieInfo.value != null) {
                    length = cookieInfo.value.length();
                }

                buf.format("\n %s[length=%d]=%s", cookieInfo.name, length, cookieInfo.value);
            }

            log.debug(buf.toString());
        }

        return cookiesInfo;
    }
View Full Code Here

        attrsBuilder.appendAll(attrs);
        attrsBuilder.remove(modelKey);

        mb.append("attrs", attrsBuilder);

        return new ToStringBuilder().append("HttpSession").append(mb).toString();
    }
View Full Code Here

        }

        // 如果失败,记录日志
        if (attrs.isEmpty() && encoderExceptions != null) {
            if (log.isWarnEnabled()) {
                ToStringBuilder buf = new ToStringBuilder();

                buf.append("Failed to decode cookie value: ").append(cookieValue);

                int i = 0;
                for (Exception e : encoderExceptions) {
                    buf.format("\n  Encoder #%d - %s threw %s", i + 1, encoders[i].getClass().getSimpleName(), e);
                }

                log.warn(buf.toString());
            }
        } else {
            if (log.isDebugEnabled()) {
                int attrCount = attrs.size();
                ToStringBuilder buf = new ToStringBuilder();

                buf.format("Found %d attributes:", attrCount);

                if (!attrs.isEmpty()) {
                    buf.append(new MapBuilder().setPrintCount(true).setSortKeys(true).appendAll(attrs));
                }

                log.debug(buf.toString());
            }
        }

        return attrs;
    }
View Full Code Here

        getLogger().debug("Cleared thread-bound request context: {}", request);
    }

    @Override
    public String toString() {
        ToStringBuilder buf = new ToStringBuilder();

        buf.append(getBeanDescription()).start();

        for (RequestContextFactory<?> factory : factories) {
            buf.format("  %s with features %s, ordering %s\n", factory.getRequestContextInterface().getSimpleName(),
                       asList(factory.getFeatures()), asList(factory.featureOrders()));
        }

        return buf.end().toString();
    }
View Full Code Here

        mb.append("moduleClass", moduleObject.getClass().getName());
        mb.append("handlers", new MapBuilder().appendAll(handlers).setPrintCount(true).setSortKeys(true));
        mb.append("preHandler", preHandler);
        mb.append("postHandler", postHandler);

        return new ToStringBuilder().append(getClass().getSimpleName()).append(mb).toString();
    }
View Full Code Here

        MapBuilder mb = new MapBuilder();

        mb.append("moduleClass", moduleObject.getClass().getName());
        mb.append("executeMethod", executeMethod);

        return new ToStringBuilder().append(getClass().getSimpleName()).append(mb).toString();
    }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.util.ToStringBuilder$MapBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.