変換規則から、{@link DateTimeFormatter}のインスタンスを作成する。
<p>アノテーション{@link CsvDateTimeFormat}が付与されていない場合は、各種タイプごとの標準の書式で作成する。</p>
@param field フィールド情報
@param config システム設定
@return {@link DateTimeFormatter}のインスタンス。
354586
protected DateTimeFormatter createFormatter(final FieldAccessor field, final Configuration config) {
        
        final Optional<CsvDateTimeFormat> formatAnno = field.getAnnotation(CsvDateTimeFormat.class);
        if(!formatAnno.isPresent()) {
            return DateTimeFormat.forPattern(getDefaultPattern());
        }
        
        String pattern = formatAnno.get().pattern();
        if(pattern.isEmpty()) {
            pattern = getDefaultPattern();
        }
        
        final Locale locale = Utils.getLocale(formatAnno.get().locale());
        final DateTimeZone zone = formatAnno.get().timezone().isEmpty() ? DateTimeZone.getDefault()
                : DateTimeZone.forTimeZone(TimeZone.getTimeZone(formatAnno.get().timezone()));
        
        final DateTimeFormatter formatter = DateTimeFormat.forPattern(pattern)
                .withLocale(locale)
                .withZone(zone);
        
        final boolean lenient = formatAnno.get().lenient();
        if(lenient) {
            Chronology chronology = LenientChronology.getInstance(ISOChronology.getInstance());
            return formatter.withChronology(chronology);
            
        } else {
            return formatter;
        }
        
    }
45037
@Override
    public void configFields(Configuration conf, String[] fields) throws IOException {
        if (null != fields) {
            super.configFields(conf, fields);
            for (int i = 0; i < fields.length; i++) {
                if(fields[i].trim().equals("")) continue;
                if (!XML11Char.isXML11ValidName(fields[i])) {
                    fields[i] = XMLUtil.getValidName(fields[i]);
                }
            }
        } else {
            throw new IOException("Fields not defined");
        }
    }
701059
public static String getMapFieldGenericParameterString(FieldInfo field) {
        FieldType fieldType = ProtobufProxyUtils.TYPE_MAPPING.get(field.getGenericKeyType());
        String keyClass;
        String defaultKeyValue;
        if (fieldType == null) {
            // may be object or enum
            if (Enum.class.isAssignableFrom(field.getGenericKeyType())) {
                keyClass = WIREFORMAT_CLSNAME + ".ENUM";
                Class<?> declaringClass = field.getGenericKeyType();
                Field[] fields = declaringClass.getFields();
                if (fields != null && fields.length > 0) {
                    defaultKeyValue = ClassHelper.getInternalName(field.getGenericKeyType().getCanonicalName()) + "."
                            + fields[0].getName();
                } else {
                    defaultKeyValue = "0";
                }

            } else {
                keyClass = WIREFORMAT_CLSNAME + ".MESSAGE";
                // check constructor
                boolean hasDefaultConstructor = ClassHelper.hasDefaultConstructor(field.getGenericKeyType());
                if (!hasDefaultConstructor) {
                    throw new IllegalArgumentException("Class '" + field.getGenericKeyType().getCanonicalName()
                            + "' must has default constructor method with no parameters.");
                }
                defaultKeyValue = "new " + ClassHelper.getInternalName(field.getGenericKeyType().getCanonicalName()) + "()";
            }
        } else {
            keyClass = WIREFORMAT_CLSNAME + "." + fieldType.toString();
            defaultKeyValue = fieldType.getDefaultValue();
        }

        fieldType = ProtobufProxyUtils.TYPE_MAPPING.get(field.getGenericeValueType());
        String valueClass;
        String defaultValueValue;
        if (fieldType == null) {
            // may be object or enum
            if (Enum.class.isAssignableFrom(field.getGenericeValueType())) {
                valueClass = WIREFORMAT_CLSNAME + ".ENUM";
                Class<?> declaringClass = field.getGenericeValueType();
                Field[] fields = declaringClass.getFields();
                if (fields != null && fields.length > 0) {
                    defaultValueValue = ClassHelper.getInternalName(field.getGenericeValueType().getCanonicalName()) + "."
                            + fields[0].getName();
                } else {
                    defaultValueValue = "0";
                }

            } else {
                valueClass = WIREFORMAT_CLSNAME + ".MESSAGE";
                // check constructor
                boolean hasDefaultConstructor = ClassHelper.hasDefaultConstructor(field.getGenericeValueType());
                if (!hasDefaultConstructor) {
                    throw new IllegalArgumentException("Class '" + field.getGenericeValueType().getCanonicalName()
                            + "' must has default constructor method with no parameters.");
                }
                defaultValueValue = "new " + ClassHelper.getInternalName(field.getGenericeValueType().getCanonicalName()) + "()";
            }
        } else {
            valueClass = WIREFORMAT_CLSNAME + "." + fieldType.toString();
            defaultValueValue = fieldType.getDefaultValue();
        }
        String joinedSentence = keyClass + "," + defaultKeyValue + "," + valueClass + "," + defaultValueValue;
        return joinedSentence;
    }
761583
public static String changeTimestampToNewFormat(String isoTimestamp,
            DateTimeFormatter newFormat) {
        return ZonedDateTime.parse(isoTimestamp).format(newFormat);
    }
655287
public static String format(ITemplate template, Date date, String pattern, Locale locale, String timezone) {
        if (null == date) throw new NullPointerException();
        RythmEngine engine = null == template ? RythmEngine.get() : template.__engine();
        DateFormat df =  (null == engine ? IDateFormatFactory.DefaultDateFormatFactory.INSTANCE : engine.dateFormatFactory()).createDateFormat(template, pattern, locale, timezone);

        return df.format(date);
    }
754768
private void assertValidDateFieldType(Optional<Field> field) {

		field.ifPresent(it -> {

			if (SUPPORTED_DATE_TYPES.contains(it.getType().getName())) {
				return;
			}

			Class<?> type = it.getType();

			if (Jsr310Converters.supports(type)
					|| ThreeTenBackPortConverters.supports(type)) {
				return;
			}

			throw new IllegalStateException(String.format(
					"Found created/modified date field with type %s but only %s as well as java.time types are supported!",
					type, SUPPORTED_DATE_TYPES));
		});
	}
1161624
@SuppressWarnings({"unchecked", "rawtypes"})
    public void registerFieldFormatter(final String field, final Class<?> fieldType, final FieldFormatter<?> formatter,
            final boolean strippedIndex) {
        
        String fieldPath = buildFieldPath(field);
        
        if(strippedIndex) {
            // パスからインデックスやキーを削除する
            List<String> strippedPaths = new ArrayList<>();
            fieldFormatterRegistry.addStrippedPropertyPaths(strippedPaths, "", fieldPath);
            
            if(strippedPaths.size() > 0) {
                // 辞書順位並び変えて先頭に来るのが、インデックスを全て削除されたパス
                Collections.sort(strippedPaths);
                fieldPath = strippedPaths.get(0);
            }
        }
        
        fieldFormatterRegistry.registerFormatter(fieldPath, (Class)fieldType, (FieldFormatter)formatter);
        
    }
1230815
private boolean isCsvField(final String field, final ValidationContext<Object> validationContext) {
        return validationContext.getBeanMapping().getColumnMapping(field).isPresent();
    }
691264
public DateTime setField(int field, int value) {
		final Calendar calendar = toCalendar();
		calendar.set(field, value);

		DateTime dt = this;
		if (false == mutable) {
			dt = ObjectUtil.clone(this);
		}
		return dt.setTimeInternal(calendar.getTimeInMillis());
	}
135264
public static String time2String(java.sql.Timestamp time, Locale locale) {
        DateFormat df = DateFormat.getDateTimeInstance(dateStyle, timeStyle, locale);
        return df.format(time);
    }
275396
public static DateTimeFormatter formatWithDefault(String lang, String country) {
        return (StringUtils.isNotBlank(lang)) ? DateTimeFormat.longDateTime().withLocale(DateTimeUtils.getLocaleByCountry(lang, country)) :
                DateTimeFormat.longDateTime().withLocale(Locale.getDefault());
    }
145829
public Rowtime timestampsFromField(String fieldName) {
		internalProperties.putString(ROWTIME_TIMESTAMPS_TYPE, ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD);
		internalProperties.putString(ROWTIME_TIMESTAMPS_FROM, fieldName);
		return this;
	}
82071
@Override
    public ValueRange range(ChronoField field) {
        switch (field) {
            case ALIGNED_DAY_OF_WEEK_IN_YEAR:
                return ALIGNED_DOW_OF_YEAR_RANGE;
            case ALIGNED_DAY_OF_WEEK_IN_MONTH:
            case DAY_OF_WEEK:
                return DAY_OF_WEEK_RANGE;
            case ALIGNED_WEEK_OF_MONTH:
                return WEEK_OF_MONTH_RANGE;
            case ALIGNED_WEEK_OF_YEAR:
                return WEEK_OF_YEAR_RANGE;
            case DAY_OF_MONTH:
                return DAY_OF_MONTH_RANGE;
            case EPOCH_DAY:
                return EPOCH_DAY_RANGE;
            case ERA:
                return ERA_RANGE;
            case MONTH_OF_YEAR:
                return MONTH_OF_YEAR_RANGE;
            case PROLEPTIC_MONTH:
                return PROLEPTIC_MONTH_RANGE;
            case YEAR_OF_ERA:
            case YEAR:
                return YEAR_RANGE;
            default:
                break;
        }
        return field.range();
    }
1211458
@Override
    public DateRangeMapper build(String field) {
        return new DateRangeMapper(field, validated, from, to, pattern);
    }
1127421
private TypeSpec createFormatter(DateTimeData dateTimeData, TimeZoneData timeZoneData, String className) {
    LocaleID id = dateTimeData.id;

    MethodSpec.Builder constructor = MethodSpec.constructorBuilder()
        .addModifiers(PUBLIC);

    constructor.addStatement("this.bundleId = $T.$L", CLDR_LOCALE_IF, id.safe);
    constructor.addStatement("this.firstDay = $L", dateTimeData.firstDay);
    constructor.addStatement("this.minDays = $L", dateTimeData.minDays);

    variantsFieldInit(constructor, "this.eras", dateTimeData.eras);
    variantsFieldInit(constructor, "this.quartersFormat", dateTimeData.quartersFormat);
    variantsFieldInit(constructor, "this.quartersStandalone", dateTimeData.quartersStandalone);
    variantsFieldInit(constructor, "this.monthsFormat", dateTimeData.monthsFormat);
    variantsFieldInit(constructor, "this.monthsStandalone", dateTimeData.monthsStandalone);
    variantsFieldInit(constructor, "this.weekdaysFormat", dateTimeData.weekdaysFormat);
    variantsFieldInit(constructor, "this.weekdaysStandalone", dateTimeData.weekdaysStandalone);
    variantsFieldInit(constructor, "this.dayPeriodsFormat", dateTimeData.dayPeriodsFormat);
    variantsFieldInit(constructor, "this.dayPeriodsStandalone", dateTimeData.dayPeriodsStandalone);

    buildTimeZoneExemplarCities(constructor, timeZoneData);
    buildTimeZoneNames(constructor, timeZoneData);
    buildMetaZoneNames(constructor, timeZoneData);
    
    TypeSpec.Builder type = TypeSpec.classBuilder(className)
        .superclass(CALENDAR_FORMATTER)
        .addModifiers(PUBLIC)
        .addJavadoc(
            "Locale \"" + dateTimeData.id + "\"\n" +
            "See http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n")
        .addMethod(constructor.build());

    MethodSpec dateMethod = buildTypedPatternMethod("formatDate", CALENDAR_FORMAT, dateTimeData.dateFormats);
    MethodSpec timeMethod = buildTypedPatternMethod("formatTime", CALENDAR_FORMAT, dateTimeData.timeFormats);
    MethodSpec wrapperMethod = buildWrapperMethod(dateTimeData.dateTimeFormats);
    MethodSpec skeletonMethod = buildSkeletonFormatter(dateTimeData.dateTimeSkeletons);
    MethodSpec intervalMethod = buildIntervalMethod(dateTimeData.intervalFormats, dateTimeData.intervalFallbackFormat);
    MethodSpec gmtMethod = buildWrapTimeZoneGMTMethod(timeZoneData);
    MethodSpec regionFormatMethod = buildWrapTimeZoneRegionMethod(timeZoneData);

    return type
        .addMethod(dateMethod)
        .addMethod(timeMethod)
        .addMethod(wrapperMethod)
        .addMethod(skeletonMethod)
        .addMethod(intervalMethod)
        .addMethod(gmtMethod)
        .addMethod(regionFormatMethod)
        .build();
  }
3106
public DateTimeFormatterBuilder appendText(DateTimeFieldType fieldType) {
        if (fieldType == null) {
            throw new IllegalArgumentException("Field type must not be null");
        }
        return append0(new TextField(fieldType, false));
    }
633844
public static StringBuilder durationConfigString(Duration duration) {
        Duration remainder = duration;

        long days = remainder.getStandardDays();
        remainder = remainder.minus(Duration.standardDays(days));

        long hours = remainder.getStandardHours();
        remainder = remainder.minus(Duration.standardHours(hours));

        long minutes = remainder.getStandardMinutes();
        remainder = remainder.minus(Duration.standardMinutes(minutes));

        long seconds = remainder.getStandardSeconds();
        remainder = remainder.minus(Duration.standardSeconds(seconds));

        if (!remainder.isEqual(Duration.ZERO))
            Logger.getLogger(ConfigSupport.class.getName()).log(Level.WARNING, "Duration is more precise than configuration will handle: {0}, dropping remainder: {1}", new Object[]{duration, remainder});

        StringBuilder result = new StringBuilder();
        if (days != 0) {
            if (result.length() != 0) result.append(' ');
            result.append(days).append('d');
        }
        if (hours != 0) {
            if (result.length() != 0) result.append(' ');
            result.append(hours).append('h');
        }
        if (minutes != 0) {
            if (result.length() != 0) result.append(' ');
            result.append(minutes).append('m');
        }
        if (result.length() == 0 || seconds != 0) {
            if (result.length() != 0) result.append(' ');
            result.append(seconds).append('s');
        }

        return result;
    }