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); }
Attribute statusAttribute = new Attribute(); statusAttribute.setName(NameParser.parseUsingCase("Status")); statusAttribute.setType(model.getStringType()); Attribute faultAttribute = new Attribute(); faultAttribute.setName(NameParser.parseUsingCase("Fault")); faultAttribute.setType(model.getType(NameParser.parseUsingCase("Fault"))); Attribute gracePeriodAttribute = new Attribute(); gracePeriodAttribute.setName(NameParser.parseUsingCase("GracePeriod")); gracePeriodAttribute.setType(model.getType(NameParser.parseUsingCase("GracePeriod"))); Attribute jobAttribute = new Attribute(); jobAttribute.setName(NameParser.parseUsingCase("Job")); jobAttribute.setType(model.getType(NameParser.parseUsingCase("Job"))); Attribute parameterAttribute = new Attribute(); parameterAttribute.setName(parameter.getName()); parameterAttribute.setType(parameter.getType());
/** * 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); }