use of org.springframework.ide.vscode.commons.util.AlwaysFailingParser in project sts4 by spring-projects.
the class TypeUtil method getValueParser.
public ValueParser getValueParser(Type type) {
ValueParser simpleParser = VALUE_PARSERS.get(type.getErasure());
if (simpleParser != null) {
return simpleParser;
}
Collection<StsValueHint> enumValues = getAllowedValues(type, EnumCaseMode.ALIASED);
if (enumValues != null) {
// assigning anything to it is an error.
return new EnumValueParser(niceTypeName(type), getBareValues(enumValues));
}
if (isMap(type)) {
// provide a parser that allows throws
return new AlwaysFailingParser(niceTypeName(type));
}
if (isSequencable(type)) {
// Trying to parse list from scalars is possible if the domain type is parseable. Spring boot
// will try to interpret the string as a comma-separated list
Type elType = getDomainType(type);
if (elType != null) {
ValueParser elParser = getValueParser(elType);
if (elParser != null) {
return new DelimitedStringParser(elParser);
}
}
}
return null;
}
Aggregations