Example usage for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE

List of usage examples for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE.

Prototype

ToStringStyle SHORT_PREFIX_STYLE

To view the source code for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE.

Click Source Link

Document

The short prefix toString style.

Usage

From source file:com.mxhero.plugin.cloudstorage.onedrive.api.OneDrive.java

/**
 * Redeem daemon./* www . j  a v  a  2 s.co  m*/
 *
 * @param redeemDaemonRequest the redeem daemon request
 * @return the Access Token redeemed it
 * @throws AuthenticationException the authentication exception
 */
public static String redeemDaemon(RedeemDaemonRequest redeemDaemonRequest) throws AuthenticationException {
    ExecutorService service = Executors.newCachedThreadPool();
    AuthenticationResult authenticationResult = null;
    String authority = String.format(ApiEnviroment.tokenDaemonBaseUrl.getValue(),
            redeemDaemonRequest.getTenantId());
    logger.debug("Trying to get App Only token for {}", redeemDaemonRequest);
    try {
        AuthenticationContext authenticationContext = new AuthenticationContext(authority, false, service);
        String filePkcs12 = ApiEnviroment.fileUrlPkcs12Certificate.getValue();
        if (StringUtils.isNotEmpty(redeemDaemonRequest.getFileUrlPkcs12Certificate())) {
            filePkcs12 = redeemDaemonRequest.getFileUrlPkcs12Certificate();
        }

        String filePkcs12Secret = ApiEnviroment.pkcs12CertificateSecret.getValue();
        if (StringUtils.isNotEmpty(redeemDaemonRequest.getCertificateSecret())) {
            filePkcs12Secret = redeemDaemonRequest.getCertificateSecret();
        }

        Validate.notEmpty(filePkcs12,
                "Pkcs12 Key file path must be provided or configured. You can set it on environment var 'ONEDRIVE_DAEMON_PKCS12_FILE_URL' or through Java System Property 'onedrive.daemon.pkcs12.file.url'");
        Validate.notEmpty(filePkcs12Secret,
                "Pkcs12 Secret Key file must be provided or configured. You can set it on environment var 'ONEDRIVE_DAEMON_PKCS12_FILE_SECRET' or through Java System Property 'onedrive.daemon.pkcs12.file.secret'");

        InputStream pkcs12Certificate = new FileInputStream(filePkcs12);
        AsymmetricKeyCredential credential = AsymmetricKeyCredential.create(redeemDaemonRequest.getClientId(),
                pkcs12Certificate, filePkcs12Secret);

        Future<AuthenticationResult> future = authenticationContext
                .acquireToken(redeemDaemonRequest.getResourceSharepointId(), credential, null);
        authenticationResult = future.get(10, TimeUnit.SECONDS);
        logger.debug("Token retrieved {}",
                ToStringBuilder.reflectionToString(authenticationResult, ToStringStyle.SHORT_PREFIX_STYLE));
        return authenticationResult.getAccessToken();
    } catch (Exception e) {
        logger.error("Error trying to get new App Only Token", e);
        throw new AuthenticationException(
                String.format("Error trying to get new App Only Token for tenantId %s and sharepointUri %s",
                        redeemDaemonRequest.getTenantId(), redeemDaemonRequest.getResourceSharepointId()));
    } finally {
        service.shutdown();
    }

}

From source file:com.likethecolor.alchemy.api.entity.KeywordAlchemyEntityTest.java

@Test
public void testToString_Formatted() {
    final ToStringStyle style = ToStringStyle.SHORT_PREFIX_STYLE;
    final String keyword = "Santa Rosa County";
    final Double score = 0.656468D;
    final boolean isMixed = true;
    final Double sentimentScore = -0.152724D;
    final SentimentAlchemyEntity.TYPE type = SentimentAlchemyEntity.TYPE.NEGATIVE;

    final SentimentAlchemyEntity sentimentEntity = new SentimentAlchemyEntity(isMixed, sentimentScore,
            type.toString());/*www .ja  va2 s . c o m*/

    final KeywordAlchemyEntity entity = new KeywordAlchemyEntity(keyword, score, sentimentEntity);

    final String expectedString = new ToStringBuilder(entity, style).append("keyword", keyword)
            .append("score", score).append("sentiment", sentimentEntity).toString();

    final String actualString = entity.toString(style);

    assertEquals(expectedString, actualString);
}

From source file:com.careerly.common.support.response.StandardJsonObject.java

/** -----------------equals/hashCode--------------------- **/

@Override//w  w w  . j a  v a2  s  .c  o  m
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}

From source file:jenkins.plugins.publish_over.BapPublisher.java

public String toString() {
    return addToToString(new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)).toString();
}

From source file:jp.primecloud.auto.common.component.DnsStrategy.java

/**
 * TODO: //from ww  w . j ava2 s  .  c  o m
 *
 * @param ipAddress
 */
public void deleteReverse(String ipAddress) {
    List<String> commands = createCommands();

    List<String> stdins = createStdinsCommon();
    stdins.addAll(createDeleteReverse(ipAddress));
    stdins.add("quit");

    CommandResult result = execute(commands, stdins);

    if (result.getExitValue() != 0) {
        // ????
        AutoException exception = new AutoException("ECOMMON-000209", ipAddress);
        exception.addDetailInfo(
                "result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
        throw exception;
    }

    // ????
    long timeout = 10000L;
    long startTime = System.currentTimeMillis();
    while (true) {
        String hostName = getHostName(ipAddress);
        if (StringUtils.equals(ipAddress, hostName)) {
            break;
        }
        if (System.currentTimeMillis() - startTime > timeout) {
            // 
            throw new AutoException("ECOMMON-000210", ipAddress, hostName);
        }
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ignore) {
        }
    }
}

From source file:com.dianping.squirrel.client.config.StoreCategoryConfig.java

public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("category", category)
            .append("duration", duration).append("template", indexTemplate).append("storeType", cacheType)
            .append("version", version).append("isHot", isHot).append("extension", extension).toString();
}

From source file:easycare.web.user.NewUserForm.java

public String createAuditDescription() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("username", username)
            .append("email", getEmail()).append("roles", userRoles)
            .append("locations", hasAllLocationsAccess() ? "all" : locations).toString();
}

From source file:com.icebreak.p2p.dataobject.InstitutionsInfoDO.java

/**
 * @return// ww  w  . j a v a2  s  .  co  m
 * 
 * @see java.lang.Object#toString()
 */
@Override
public String toString() {

    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}

From source file:com.iisigroup.cap.model.GenericBean.java

/**
 * toString/*  www  . j  a  va  2s  .co  m*/
 * 
 * @return string
 */
public String toString() {
    return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE, false, false);
}

From source file:com.linkedin.restli.client.util.RestliRequestUriSignature.java

/**
 * Return a {@link String} representation of the signature. The difference to {@link #toString()} is that
 * this method always returns stable result across different Map capacity and Java versions, ideal for storing and caching.
 * This is done by visiting the Map {@link Map}s by the order of its keys.
 *
 * This method is more costly tha toString(). If there is no requirement for stability, prefer to use toString().
 */// w  w w .j a  v a  2s . co m
public String dump() {
    final ProtocolVersion protocolVersion = AllProtocolVersions.LATEST_PROTOCOL_VERSION;
    final DataMap pathKeysMap = new DataMap(URIParamUtils.encodePathKeysForUri(_pathKeys, protocolVersion));
    final DataMap queryParamsMap = QueryParamsUtil.convertToDataMap(_queryParams, _queryParamClasses,
            protocolVersion);

    final ToStringBuilder builder = new ToStringBuilder(null, ToStringStyle.SHORT_PREFIX_STYLE)
            .append("baseUriTemplate", _baseUriTemplate).append("pathKeys", Data.dump("", pathKeysMap, ""))
            .append("id", _id).append("queryParams", Data.dump("", queryParamsMap, ""));

    return builder.toString();
}