protected JType getJType(ElementType elementType) throws GenerationException { try { if (elementType == null) { return this.codeModel.VOID; } else if (elementType.isList()) { return getGenericListType(elementType.getJavaType()); } else { return this.codeModel.parseType(elementType.getJavaType()); } } catch (ClassNotFoundException e) { // this should never get thrown! throw new GenerationException(e); } }
@SuppressWarnings("deprecation") protected void generateOperationMethod( JDefinedClass serviceCls, String operationName, List<ElementType> inputTypes, Integer overloadCount) throws GenerationException { ElementType outputType1 = this.serviceDefinition.getOutputType(operationName); ElementType outputType = getAdjustedOutputType(outputType1); JType outputJType = getAdjustedJType(outputType); Map<String, JType> inputJTypeMap = new LinkedHashMap<String, JType>(); JMethod method = serviceCls.method(JMod.PUBLIC, outputJType, operationName); for (ElementType inputType : inputTypes) { JType paramJType = getJType(inputType); String paramName = inputType.getName(); method.param(paramJType, paramName); inputJTypeMap.put(paramName, paramJType); } addAdditionalInputParams(method, operationName); JBlock body = method.body(); JTryBlock tryBlock = null; if (this.useNDCLogging) { tryBlock = body._try(); body = tryBlock.body(); body.staticInvoke(this.codeModel.ref(NDC.class), NDC_PUSH) .arg(getClassName() + "." + operationName); } generateOperationMethodBody( method, body, operationName, inputJTypeMap, outputType, outputJType, overloadCount); // salesforce if (this.useNDCLogging) { tryBlock._finally().block().staticInvoke(this.codeModel.ref(NDC.class), NDC_POP); } }
// If maniopulation of the generated java type is needed, extend this class and override this // method. protected String getOutputJavaType(ElementType outputType) { return outputType.getJavaType(); }