private void analyzeStructAttribute(JavaMethod javaMethod, StructType type) { // Create the model: Attribute attribute = new Attribute(); analyzeName(javaMethod, attribute); analyzeAnnotations(javaMethod, attribute); analyzeDocumentation(javaMethod, attribute); // Get the type: assignTypeReference(javaMethod.getReturns(), attribute::setType); // Add the member to the struct: attribute.setDeclaringType(type); type.addAttribute(attribute); }
/** * Adds the {@code Fault} type to the model. */ private void addFaultType(Model model) { // Create the type: StructType faultType = new StructType(); faultType.setName(NameParser.parseUsingCase("Fault")); // Add the "reason" attribute: Attribute reasonAttribute = new Attribute(); reasonAttribute.setName(NameParser.parseUsingCase("Reason")); reasonAttribute.setType(model.getStringType()); reasonAttribute.setDeclaringType(faultType); faultType.addAttribute(reasonAttribute); // Add the "detail" attribute: Attribute detailAttribute = new Attribute(); detailAttribute.setName(NameParser.parseUsingCase("Detail")); detailAttribute.setType(model.getStringType()); detailAttribute.setDeclaringType(faultType); faultType.addAttribute(detailAttribute); // Add the type to the model: faultType.setModule(model.getModule(null)); model.addType(faultType); }
statusAttribute.setType(model.getStringType()); statusAttribute.setDeclaringType(actionType); actionType.addAttribute(statusAttribute); faultAttribute.setType(model.getType(NameParser.parseUsingCase("Fault"))); faultAttribute.setDeclaringType(actionType); actionType.addAttribute(faultAttribute); gracePeriodAttribute.setType(model.getType(NameParser.parseUsingCase("GracePeriod"))); gracePeriodAttribute.setDeclaringType(actionType); actionType.addAttribute(gracePeriodAttribute); jobAttribute.setType(model.getType(NameParser.parseUsingCase("Job"))); jobAttribute.setDeclaringType(actionType); actionType.addAttribute(jobAttribute); parameterAttribute.setType(parameter.getType()); parameterAttribute.setDeclaringType(actionType); actionType.addAttribute(parameterAttribute); });
/** * Adds the {@code GracePeriod} type to the model. */ private void addGracePeriodType(Model model) { // Create the type: StructType gracePeriodType = new StructType(); gracePeriodType.setName(NameParser.parseUsingCase("GracePeriod")); // Add the "expiry" attribute: Attribute expiryAttribute = new Attribute(); expiryAttribute.setName(NameParser.parseUsingCase("Expiry")); expiryAttribute.setType(model.getIntegerType()); expiryAttribute.setDeclaringType(gracePeriodType); gracePeriodType.addAttribute(expiryAttribute); // Add the type to the model: gracePeriodType.setModule(model.getModule(null)); model.addType(gracePeriodType); }