nablarch.core.util.Builder.concat()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中nablarch.core.util.Builder.concat()方法的一些代码示例,展示了Builder.concat()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Builder.concat()方法的具体详情如下:
包路径:nablarch.core.util.Builder
类名称:Builder
方法名:concat

Builder.concat介绍

[英]elementsの各要素のtoString()の結果を単純に連結した文字列を返す。 大量の文字列連結を行う場合、+演算子による連結より処理効率がよい。

String str = Builder.concat("あ", "い", "う"); //--> "あいう"

[中]元素の各要素のtoString()の結果を単純に連結した文字列を返す。 大量の文字列連結を行う場合、+演算子による連結より処理効率がよい。

String str = Builder.concat("あ", "い", "う"); //--> "あいう"

代码示例

代码示例来源:origin: com.nablarch.framework/nablarch-core

/**
 * ベースパスを追加する際に発生する例外メッセージの共通部を取得する。
 * @param basePathName ベースパスの論理名
 * @param path ベースパス
 * @return ベースパスが不正な場合の例外メッセージの共通部
 */
private static String getAddBasePathExceptionMessage(String basePathName, String path) {
  return Builder.concat("base path=[", path, "], base path name=[", basePathName, "].");
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-web-extension

/**
 * applyFormat に失敗した際に送出する例外を作成する。
 * 
 * @param basePathName フォーマットファイルのベースパス名
 * @param layoutFileName フォーマットファイルの論理名
 * @param layoutFile フォーマットファイル
 * @param e 元例外
 * @return applyFormat に失敗した際に送出する例外
 */
private IllegalStateException createApplyFormatException(String basePathName,
    String layoutFileName, File layoutFile, Throwable e) {
  return new IllegalStateException(concat(
      "fail applying format file. basePathName=[", basePathName, "] ",
      "layoutFileName=[", layoutFileName, "] ",
      "layoutFile=[", layoutFile.getAbsolutePath(), "]",
      "partInfo=[", partInfo, "]"), e);
}

代码示例来源:origin: com.nablarch.framework/nablarch-core-validation

/**
 * トリムポリシーを設定する。
 * 
 * @param trimPolicy トリムポリシー
 */
public void setTrimPolicy(String trimPolicy) {
  
  if (StringUtil.isNullOrEmpty(trimPolicy)) {
    throw new IllegalArgumentException(Builder.concat(
        "invalid property value was specified."
       , " 'trimPolicy' property must not be empty."
       , " supported trim policy name=[\""
       , TRIM_ALL, "\", \"", NO_TRIM, "\"]."));
  }
  
  if (!(TRIM_ALL.equals(trimPolicy) || NO_TRIM.equals(trimPolicy))) {
    throw new IllegalArgumentException(Builder.concat(
        "invalid property value was specified."
       , " '", trimPolicy , "' was not supported trim policy name."
       , " supported trim policy name=[\""
       , TRIM_ALL, "\", \"", NO_TRIM, "\"]."));
  }
  this.trimPolicy = trimPolicy;
}

代码示例来源:origin: com.nablarch.framework/nablarch-core-validation

/**
 * このオブジェクトの文字列表現を返す。
 * @return メッセージIDとバリデーション対象プロパティを記載した文字列
 */
@Override
public String toString() {
  return concat(
      "messageId=[", getMessageId(), "] ",
      "propertyName=[", getPropertyName(), "]"
      );
}

代码示例来源:origin: com.nablarch.framework/nablarch-core-applog

/**
 * ログ出力後に、ロックを解放する。
 * <p/>
 * ロックの解放処理は、ロックファイルを削除することによって行う。
 * @param formattedMessage フォーマット済みのログ(本メソッドでは使用していない)
 * @param context ログエントリオブジェクト
 */
protected void releaseLock(String formattedMessage, LogContext context) {
  if (!lockFile.delete()) {
    String lockFileAbsolutePath = lockFile.getAbsolutePath();
    String failureMessage = getFormattingFailureMessage(
        context
       , Builder.concat("failed to delete lock file. lock file path=[", lockFileAbsolutePath, "].")
       , failureCodeReleaseLockFile
       , lockFileAbsolutePath);
    super.onWrite(failureMessage);
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-core-applog

/**
 * 待機時間を過ぎても残存しているロックファイルを強制的に削除する。
 * @param lockFile ロックファイル
 * @param formattedMessage フォーマット済みのログ
 * @param context ログエントリオブジェクト
 * @return ロックファイルの強制削除が正常に終了したかどうか
 */
protected boolean deleteLockFileExceedsLockWaitTime(File lockFile, String formattedMessage, LogContext context) {
  // 不要なロックファイルが残存しているとみなし削除
  if (!lockFile.delete()) {
    String lockFileAbsolutePath = lockFile.getAbsolutePath();
    // ロックファイルの強制削除ができなかった場合、ロックの取得は不可能と判断し強制的にログを出力する
    String failureMessage = getFormattingFailureMessage(
        context
       , Builder.concat("failed to delete lock file forcedly. lock file was opened illegally. lock file path=[", lockFileAbsolutePath, "].")
       , failureCodeForceDeleteLockFile
       , lockFileAbsolutePath);
    forceWrite(formattedMessage, context, failureMessage);
    return false;
  }
  return true;
}

代码示例来源:origin: com.nablarch.framework/nablarch-core-applog

/**
 * ロック待ち処理を行う。
 * <p/>
 * ロック取得の再試行間隔(ミリ秒)で設定された時間、スレッドをスリープさせる。
 * @param lockFile ロックファイル
 * @param formattedMessage フォーマット済みのログ
 * @param context ログエントリオブジェクト
 * @return もし割り込みが発生した場合にはfalse
 */
protected boolean waitLock(File lockFile, String formattedMessage, LogContext context) {
  try {
    Thread.sleep(lockRetryInterval);
  } catch (InterruptedException e) {
    String lockFileAbsolutePath = lockFile.getAbsolutePath();
    // 割り込み発生時にはロック取得の再試行は行わず、強制的にログを出力し処理を終了する
    String failureMessage = getFormattingFailureMessage(
        context
       , Builder.concat("interrupted while waiting for lock retry.")
       , failureCodeInterruptLockWait
       , lockFileAbsolutePath);
    forceWrite(formattedMessage, context, failureMessage);
    return false;
  }
  return true;
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-web-tag

/**
 * 自身のタグがFormタグの子要素として使用されているかどうか(フォームコンテキスト情報が存在するかどうか)をチェックする。
 * <p/>
 * Formタグの子要素でなければならないタグは、本メソッドを実行してチェックすること。
 * <p/>
 * 自身のタグがFormタグの子要素でない場合、IllegalStateExceptionをスローする。
 */
protected void checkChildElementsOfForm() {
  if (TagUtil.getFormContext(pageContext) == null) {
    throw new IllegalStateException(Builder.concat(
        "invalid location of the ", getTagName(), " tag. the ", getTagName(), " tag must locate in the form tag."));
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-core

Builder.concat("invalid base path was specified. base path was not directory. "
, "absolute path of the base path=[", baseDir.getAbsoluteFile(), "], "
, getAddBasePathExceptionMessage(basePathName, path)));
Builder.concat("couldn't create the base directory. "
, "absolute path of the directory path=[", baseDir.getAbsolutePath(), "], "
, getAddBasePathExceptionMessage(basePathName, path)));

代码示例来源:origin: com.nablarch.framework/nablarch-core-applog

, Builder.concat("failed to create lock file. perhaps lock file path was invalid. lock file path=[", lockFileAbsolutePath, "].")
, failureCodeCreateLockFile
, lockFileAbsolutePath);

代码示例来源:origin: com.nablarch.framework/nablarch-fw-web-extension

/**
 * フォーマット定義ファイルを取得する。
 *
 * @param basePathName   FilePathSettingのベースパス論理名
 * @param layoutFileName フォーマット定義ファイル名
 * @return フォーマット定義ファイル
 */
private File getLayoutFile(String basePathName, String layoutFileName) {
  File layoutFile = FilePathSetting.getInstance().getFileWithoutCreate(basePathName, layoutFileName);
  if (LOGGER.isDebugEnabled()) {
    LOGGER.logDebug(concat(
        "applying format file. basePathName=[", basePathName, "] ",
        "layoutFileName=[", layoutFileName, "] ",
        "layoutFile=[", layoutFile.getAbsolutePath(), "]"));
  }
  return layoutFile;
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-web-extension

/** アップロードファイルの中身をログ出力する。 */
private void logContentOfUploaded() {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.logDebug(concat(
        "content of uploaded file is [",
        BinaryUtil.convertToHexStringWithPrefix(toByteArray()),
        "]"));
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-web-extension

/**
 * バリデーションエラーをログ出力する。
 *
 * @param errorRecord エラーレコード
 * @param context     バリデーション結果
 */
private void logValidationError(DataRecord errorRecord, ValidationContext<FORM> context) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.logDebug(concat(
        "   validation error .",
        " line=[", errorRecord.getRecordNumber(), "]",
        " messages=", context.getMessages()));
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-web-extension

/**
 * レコードをログ出力する。
 *
 * @param dataRecord レコード
 * @param context    バリデーションコンテキスト
 */
private void logRecord(DataRecord dataRecord, ValidationContext<FORM> context) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.logDebug(concat(
        "invoking validation .",
        " line=[", dataRecord.getRecordNumber(), "]",
        " class=[", context.getTargetClass().getName(), "]",
        " validateFor=[", context.getValidateFor(), "]",
        " record=", dataRecord));
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-core-applog

lockRetryInterval = Long.parseLong(settings.getProp("lockRetryInterval"));
} catch (NumberFormatException e) {
  throw new IllegalArgumentException(Builder.concat(
      "invalid property was specified. 'lockRetryInterval' must be able to convert to Long. value=["
     , settings.getProp("lockRetryInterval")
  throw new IllegalArgumentException(Builder.concat(
      "invalid property was specified. 'lockRetryInterval' must be more than ", MIN_LOCK_RETRY_INTERVAL, ". value=["
     , settings.getProp("lockRetryInterval")
  lockWaitTime = Long.parseLong(settings.getProp("lockWaitTime"));
} catch (NumberFormatException e) {
  throw new IllegalArgumentException(Builder.concat(
      "invalid property was specified. 'lockWaitTime' must be able to convert to Long. value=["
     , settings.getProp("lockWaitTime")
  throw new IllegalArgumentException(Builder.concat(
      "invalid property was specified. 'lockWaitTime' must be more than 0. value=["
     , settings.getProp("lockWaitTime")

代码示例来源:origin: com.nablarch.framework/nablarch-fw-web-extension

/**
   * 形式エラーをログ出力する。
   *
   * @param e 形式エラー例外
   */
  private void logFormatError(InvalidDataFormatException e) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.logDebug(concat(
          "       format error . ",
          "line=[", e.getRecordNumber(), "] ",
          "fieldName=[", e.getFieldName(), "] ",
          e.getMessage()));
    }
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-common-auth

@Override
  public Result handleInbound(ExecutionContext context) {
    String requestId = usesInternalRequestId
        ? ThreadContext.getInternalRequestId()
        : ThreadContext.getRequestId();
    if (!serviceAvailability.isAvailable(requestId)) {
      if (LOGGER.isTraceEnabled()) {
        LOGGER.logTrace(Builder.concat(
            "service unavailable. requestId=[", requestId, "]"));
      }
      throw new ServiceUnavailable();
    }
    
    return new Result.Success();
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-common-auth

return context.handleNext(inputData);
} else {
  String message = Builder.concat(
    "permission denied. userId = [", userId, "], "
   , "requestId = [", requestId, "]"

代码示例来源:origin: com.nablarch.framework/nablarch-fw-messaging-http

LOGGER.logInfo(Builder.concat("There were no Handlers in handlerQueue.",
               " uri = [", req.getRequestUri(), "]"));
return HttpResponse.Status.NOT_FOUND.handle(req, ctx);

相关文章

微信公众号

最新文章

更多