private Configuration analyzeConfig(
DmdlSemantics environment,
AstAttribute attribute,
Map<String, AstAttributeElement> elements) {
AstLiteral charset = take(environment, elements, ELEMENT_CHARSET_NAME, LiteralKind.STRING);
AstLiteral header = take(environment, elements, ELEMENT_HAS_HEADER_NAME, LiteralKind.BOOLEAN);
AstLiteral allowlf = take(environment, elements, ELEMENT_ALLOW_LINEFEED, LiteralKind.BOOLEAN);
AstLiteral trueRep = take(environment, elements, ELEMENT_TRUE_NAME, LiteralKind.STRING);
AstLiteral falseRep = take(environment, elements, ELEMENT_FALSE_NAME, LiteralKind.STRING);
AstLiteral dateFormat = take(environment, elements, ELEMENT_DATE_NAME, LiteralKind.STRING);
AstLiteral dateTimeFormat = take(environment, elements, ELEMENT_DATE_TIME_NAME, LiteralKind.STRING);
AstLiteral codec = take(environment, elements, ELEMENT_CODEC_NAME, LiteralKind.STRING);
environment.reportAll(AttributeUtil.reportInvalidElements(attribute, elements.values()));
Configuration result = new Configuration();
if (charset != null && checkNotEmpty(environment, ELEMENT_CHARSET_NAME, charset)) {
result.setCharsetName(charset.toStringValue());
}
if (header != null) {
result.setEnableHeader(header.toBooleanValue());
}
if (allowlf != null) {
result.setAllowLinefeed(allowlf.toBooleanValue());
}
if (trueRep != null && checkNotEmpty(environment, ELEMENT_TRUE_NAME, trueRep)) {
result.setTrueFormat(trueRep.toStringValue());
}
if (falseRep != null && checkNotEmpty(environment, ELEMENT_FALSE_NAME, falseRep)) {
result.setFalseFormat(falseRep.toStringValue());
}
if (dateFormat != null && checkDateFormat(environment, ELEMENT_DATE_NAME, dateFormat)) {
result.setDateFormat(dateFormat.toStringValue());
}
if (dateTimeFormat != null && checkDateFormat(environment, ELEMENT_DATE_TIME_NAME, dateTimeFormat)) {
result.setDateTimeFormat(dateTimeFormat.toStringValue());
}
if (codec != null && checkNotEmpty(environment, ELEMENT_CODEC_NAME, codec)) {
result.setCodecName(codec.toStringValue());
}
return result;
}