use of org.apache.uima.resource.metadata.NameValuePair in project dkpro-tc by dkpro.
the class DiscriminableNameConverter method addParameters.
private static List<String> addParameters(List<String> entries, NameValuePair[] parameterSettings) {
for (int i = 0; i < parameterSettings.length; i++) {
NameValuePair nvp = parameterSettings[i];
Object value = nvp.getValue();
StringBuilder sb = new StringBuilder();
if (value instanceof Object[]) {
Object[] x = (Object[]) value;
for (int k = 0; k < x.length; k++) {
Object object = x[k];
sb.append(object);
if (k + 1 < x.length) {
sb.append(", ");
}
}
entries.add(nvp.getName() + "=" + sb.toString());
} else {
entries.add(nvp.getName() + "=" + nvp.getValue());
}
}
return entries;
}
use of org.apache.uima.resource.metadata.NameValuePair in project dkpro-tc by dkpro.
the class DiscriminableNameConverter method getCollectionReaderDescription.
public static String getCollectionReaderDescription(CollectionReaderDescription crd) {
ResourceMetaData metaData = crd.getMetaData();
ConfigurationParameterSettings settings = metaData.getConfigurationParameterSettings();
NameValuePair[] params = settings.getParameterSettings();
String implementationName = crd.getImplementationName();
List<String> entries = new ArrayList<>();
entries.add(implementationName);
entries = addParameters(entries, params);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < entries.size(); i++) {
sb.append(entries.get(i));
if (i + 1 < entries.size()) {
sb.append(", ");
}
}
String description = "[" + sb.toString() + "]";
return description;
}
Aggregations