當前位置: 首頁>>代碼示例>>Java>>正文


Java DatePatternConverter類代碼示例

本文整理匯總了Java中org.apache.logging.log4j.core.pattern.DatePatternConverter的典型用法代碼示例。如果您正苦於以下問題:Java DatePatternConverter類的具體用法?Java DatePatternConverter怎麽用?Java DatePatternConverter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DatePatternConverter類屬於org.apache.logging.log4j.core.pattern包,在下文中一共展示了DatePatternConverter類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PatternProcessor

import org.apache.logging.log4j.core.pattern.DatePatternConverter; //導入依賴的package包/類
/**
 * Constructor.
 * @param pattern The file pattern.
 */
public PatternProcessor(final String pattern) {
    final PatternParser parser = createPatternParser();
    final List<PatternConverter> converters = new ArrayList<PatternConverter>();
    final List<FormattingInfo> fields = new ArrayList<FormattingInfo>();
    parser.parse(pattern, converters, fields);
    final FormattingInfo[] infoArray = new FormattingInfo[fields.size()];
    patternFields = fields.toArray(infoArray);
    final ArrayPatternConverter[] converterArray = new ArrayPatternConverter[converters.size()];
    patternConverters = converters.toArray(converterArray);

    for (final ArrayPatternConverter converter : patternConverters) {
        if (converter instanceof DatePatternConverter) {
            final DatePatternConverter dateConverter = (DatePatternConverter) converter;
            frequency = calculateFrequency(dateConverter.getPattern());
        }
    }
}
 
開發者ID:OuZhencong,項目名稱:log4j2,代碼行數:22,代碼來源:PatternProcessor.java

示例2: PatternProcessor

import org.apache.logging.log4j.core.pattern.DatePatternConverter; //導入依賴的package包/類
/**
 * Constructor.
 * @param pattern The file pattern.
 */
public PatternProcessor(final String pattern) {
    this.pattern = pattern;
    final PatternParser parser = createPatternParser();
    final List<PatternConverter> converters = new ArrayList<>();
    final List<FormattingInfo> fields = new ArrayList<>();
    parser.parse(pattern, converters, fields, false, false, false);
    final FormattingInfo[] infoArray = new FormattingInfo[fields.size()];
    patternFields = fields.toArray(infoArray);
    final ArrayPatternConverter[] converterArray = new ArrayPatternConverter[converters.size()];
    patternConverters = converters.toArray(converterArray);

    for (final ArrayPatternConverter converter : patternConverters) {
        if (converter instanceof DatePatternConverter) {
            final DatePatternConverter dateConverter = (DatePatternConverter) converter;
            frequency = calculateFrequency(dateConverter.getPattern());
        }
    }
}
 
開發者ID:apache,項目名稱:logging-log4j2,代碼行數:23,代碼來源:PatternProcessor.java


注:本文中的org.apache.logging.log4j.core.pattern.DatePatternConverter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。