MCPcopy Create free account
hub / github.com/ddf-project/DDF / validateColumnNames

Method validateColumnNames

core/src/main/java/io/ddf/content/Schema.java:88–105  ·  view source on GitHub ↗
(List<String> names)

Source from the content-addressed store, hash-verified

86 }
87
88 private static void validateColumnNames(List<String> names) throws DDFException {
89 Set<String> columnSet = new HashSet<String>();
90 if(names != null) {
91 for(String name: names) {
92 if(columnSet.contains(name)) {
93 throw new DDFException(String.format("Duplicated column name %s", name));
94 } else {
95 if(!Utils.isAlphaNumeric(name)) {
96 throw new DDFException(String.format("Invalid column name %s, only allow alphanumeric (uppercase and lowercase a-z, numbers 0-9) " +
97 "and dash (\"-\") and underscore (\"_\")", name));
98 }
99 columnSet.add(name);
100 }
101 }
102 } else {
103 throw new DDFException("names is null");
104 }
105 }
106
107 private List<Column> parseColumnList(String columnList) {
108 if (Strings.isNullOrEmpty(columnList))

Callers 2

validateSchemaMethod · 0.95
setColumnNamesMethod · 0.95

Calls 3

isAlphaNumericMethod · 0.95
containsMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected