本文整理汇总了Java中org.apache.uima.fit.descriptor.ConfigurationParameter类的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationParameter类的具体用法?Java ConfigurationParameter怎么用?Java ConfigurationParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurationParameter类属于org.apache.uima.fit.descriptor包,在下文中一共展示了ConfigurationParameter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processParameters
import org.apache.uima.fit.descriptor.ConfigurationParameter; //导入依赖的package包/类
private static List<Map<String, Object>> processParameters(Field field) {
List<Map<String, Object>> parametersOutput = new ArrayList<>();
ConfigurationParameter[] parameters = field.getAnnotationsByType(ConfigurationParameter.class);
for (ConfigurationParameter param : parameters) {
if (ExternalResourceFactory.PARAM_RESOURCE_NAME.equals(param.name())) {
continue;
}
Map<String, Object> parameterOutput = new HashMap<>();
parameterOutput.put("name", param.name());
parameterOutput.put("defaultValue", stringArrayToString(param.defaultValue()));
parameterOutput.put("type", "parameter");
parametersOutput.add(parameterOutput);
}
return parametersOutput;
}
示例2: parseCompInfo
import org.apache.uima.fit.descriptor.ConfigurationParameter; //导入依赖的package包/类
private static CompInfo parseCompInfo(Class<?> clazz, File classFile) {
CompInfo comp = new CompInfo();
comp.name = clazz.getSimpleName();
comp.fullName = clazz.getName();
comp.javaDoc = extractJavaDoc(classFile);
try {
for (Field f : clazz.getDeclaredFields()) {
ConfigurationParameter c = f
.getAnnotation(ConfigurationParameter.class);
if (c != null) {
comp.params.add(c);
}
}
} catch (Throwable e) {
// TODO: handle exception
}
comp.scriptShortcut = clazz.getAnnotation(ScriptingShortcut.class);
return comp;
}
示例3: validateParams
import org.apache.uima.fit.descriptor.ConfigurationParameter; //导入依赖的package包/类
/**
* check that this ae or cr has the right parameters
*
* @param params
* key : val : key : val
* @param classz
* a cr or an ae
* @throws ParseException
* if the keys are not declared as fields in the classz
*/
private static void validateParams(List<Object> params, Class<?> classz) {
// skip validation if not uimafit
if (!JCasAnnotator_ImplBase.class.isAssignableFrom(classz)
&& !JCasCollectionReader_ImplBase.class.isAssignableFrom(//
classz)) {
LOG.warn(
" +- Could not validate parameters in {}. You might want to check it manually.",
classz.getName());
return;
}
for (int i = 0; i < params.size(); i = i + 2) {
String paramName = (String) params.get(i);
try {
// add fields from superclass as well
Set<Field> fields = newHashSet(classz.getDeclaredFields());
fields.addAll(newHashSet(classz.getSuperclass()
.getDeclaredFields()));
List<String> paramNames = new ArrayList<String>();
for (Field f : fields) {
if (f.isAnnotationPresent(ConfigurationParameter.class)) {
ConfigurationParameter confParam = f
.getAnnotation(ConfigurationParameter.class);
paramNames.add(confParam.name());
}
}
if (!paramNames.contains(paramName)) {
LOG.warn(
" +-XXXXXXXXX Could not find parameter '{}' in {}. You should check it.",
paramName, classz.getName());
LOG.warn(" +-XXXXXXXXX Available parameters are:\n",
join(paramNames, "\n"));
}
} catch (SecurityException e) {
LOG.error(
"could not validate params for "
+ classz.getSimpleName(), e);
}
}
}