public ConstructorInfo(Element constructorElement, ObjectFactoryParser configParser) { // factory if (constructorElement.hasAttribute("factory")) { factoryRefName = constructorElement.getAttribute("factory"); if (!constructorElement.hasAttribute("method")) { throw new JbpmException("missing method attribute in constructor"); } factoryMethodName = constructorElement.getAttribute("method"); } // factory-class else if (constructorElement.hasAttribute("factory-class")) { factoryClassName = constructorElement.getAttribute("factory-class"); if (!constructorElement.hasAttribute("method")) { throw new JbpmException("missing method attribute in constructor"); } factoryMethodName = constructorElement.getAttribute("method"); } else { if (constructorElement.hasAttribute("method")) { throw new JbpmException("missing factory or factory-class attribute in constructor"); } // class if (constructorElement.hasAttribute("class")) { className = constructorElement.getAttribute("class"); } else { throw new JbpmException("missing class, factory or factory-class attribute in constructor"); } } // parameterTypesNames and parameterInfos List parameterElements = XmlUtil.elements(constructorElement, "parameter"); parameterClassNames = new String[parameterElements.size()]; parameterInfos = new ObjectInfo[parameterElements.size()]; for (int i = 0; i < parameterElements.size(); i++) { Element parameterElement = (Element) parameterElements.get(i); if (!parameterElement.hasAttribute("class")) { throw new JbpmException("missing class attribute in constructor parameter"); } parameterClassNames[i] = parameterElement.getAttribute("class"); Element parameterInfoElement = XmlUtil.element(parameterElement); if (parameterInfoElement == null) { throw new JbpmException("missing subelement in constructor parameter"); } parameterInfos[i] = configParser.parse(parameterInfoElement); } }
public IntegerInfo(Element integerElement, ObjectFactoryParser configParser) { super(integerElement, configParser); String contentText = getValueString(integerElement); try { i = new Integer(contentText); } catch (Exception e) { throw new JbpmException( "content of " + XmlUtil.toString(integerElement) + " could not be parsed as a integer", e); } }