use of com.predic8.membrane.annot.ProcessingException in project service-proxy by membrane.
the class AttributeInfo method analyze.
private void analyze(Types typeUtils) {
if (// already analyzed?
xsdType != null)
return;
if (getE().getParameters().size() != 1)
throw new ProcessingException("Setter is supposed to have 1 parameter.", getE());
VariableElement ve = getE().getParameters().get(0);
switch(ve.asType().getKind()) {
case INT:
xsdType = "spel_number";
return;
case LONG:
xsdType = "spel_number";
return;
case BOOLEAN:
xsdType = "spel_boolean";
return;
case DECLARED:
TypeElement e = (TypeElement) typeUtils.asElement(ve.asType());
if (e.getQualifiedName().toString().equals("java.lang.String")) {
xsdType = "xsd:string";
return;
}
if (e.getSuperclass().getKind() == TypeKind.DECLARED) {
TypeElement superClass = ((TypeElement) typeUtils.asElement(e.getSuperclass()));
if (superClass.getQualifiedName().toString().equals("java.lang.Enum")) {
isEnum = true;
// TODO: restriction, but be carefull about Spring EL usage, for example "#{config.XXX}"
xsdType = "xsd:string";
/*
* <xsd:attribute name=\"target\" use=\"optional\" default=\"body\">\r\n" +
* <xsd:simpleType>\r\n" +
* <xsd:restriction base=\"xsd:string\">\r\n" +
* <xsd:enumeration value=\"body\" />\r\n" +
* <xsd:enumeration value=\"header\" />\r\n" +
* </xsd:restriction>\r\n" +
* </xsd:simpleType>\r\n" +
* </xsd:attribute>\r\n"
*/
return;
}
}
isBeanReference = true;
xsdType = "xsd:string";
return;
default:
throw new ProcessingException("Not implemented: XSD type for " + ve.asType().getKind().toString(), this.getE());
}
}
Aggregations