if (!ReflectionUtil.isAnnotationPresent(componentClass, SofaCapability.class)
&& !ReflectionUtil.isAnnotationPresent(componentClass, TypeCapability.class)) {
return null;
}
Capability capability = new Capability_impl();
if (ReflectionUtil.isAnnotationPresent(componentClass, SofaCapability.class)) {
SofaCapability annotation = ReflectionUtil.getAnnotation(componentClass, SofaCapability.class);
String[] inputSofas = annotation.inputSofas();
if (inputSofas.length == 1 && inputSofas[0].equals(SofaCapability.NO_DEFAULT_VALUE)) {
inputSofas = new String[0];
}
capability.setInputSofas(inputSofas);
String[] outputSofas = annotation.outputSofas();
if (outputSofas.length == 1 && outputSofas[0].equals(SofaCapability.NO_DEFAULT_VALUE)) {
outputSofas = new String[0];
}
capability.setOutputSofas(outputSofas);
}
if (ReflectionUtil.isAnnotationPresent(componentClass, TypeCapability.class)) {
TypeCapability annotation = ReflectionUtil.getAnnotation(componentClass, TypeCapability.class);
String[] inputTypesOrFeatureNames = annotation.inputs();
capability.setInputs(createTypesOrFeatures(inputTypesOrFeatureNames));
String[] outputTypesOrFeatureNames = annotation.outputs();
capability.setOutputs(createTypesOrFeatures(outputTypesOrFeatureNames));
}
return capability;
}