use of org.infernus.idea.checkstyle.csapi.KnownTokenTypes in project checkstyle-idea by jshiell.
the class OpPeruseConfiguration method buildModuleInfo.
@Nullable
private ConfigurationModule buildModuleInfo(@NotNull final Configuration currentConfig) throws CheckstyleException {
final String name = currentConfig.getName();
final Map<String, String> messages = messagesFrom(currentConfig);
final Map<String, String> properties = new HashMap<>();
Set<KnownTokenTypes> knownTokenTypes = EnumSet.noneOf(KnownTokenTypes.class);
for (String key : currentConfig.getAttributeNames()) {
if (key != null) {
String value = currentConfig.getAttribute(key);
if (value != null) {
if (TOKENS_PROP.equals(key)) {
knownTokenTypes = buildKnownTokenTypesSet(value);
} else {
properties.put(key, value);
}
}
}
}
ConfigurationModule result = null;
if (name != null) {
result = new ConfigurationModule(name, properties, knownTokenTypes, messages);
}
return result;
}
use of org.infernus.idea.checkstyle.csapi.KnownTokenTypes in project checkstyle-idea by jshiell.
the class OpPeruseConfiguration method buildKnownTokenTypesSet.
private Set<KnownTokenTypes> buildKnownTokenTypesSet(final String value) {
final Set<KnownTokenTypes> result = EnumSet.noneOf(KnownTokenTypes.class);
final String[] tokenStrings = value.split("\\s*,\\s*");
for (String tokenStr : tokenStrings) {
KnownTokenTypes knownToken;
try {
knownToken = KnownTokenTypes.valueOf(tokenStr);
} catch (IllegalArgumentException e) {
knownToken = null;
}
if (knownToken != null) {
result.add(knownToken);
}
}
return result;
}
Aggregations