/** * 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); }
private void writeStructMembers(StructType type) { // Write the attributes and links that are represented as XML elements: writer.writeStartElement(XS_URI, "sequence"); type.declaredAttributes() .filter(x -> !schemaNames.isRepresentedAsAttribute(x.getName())) .sorted() .forEach(this::writeStructMemberAsElement); type.declaredLinks() .filter(x -> !schemaNames.isRepresentedAsAttribute(x.getName())) .sorted() .forEach(this::writeStructMemberAsElement); writer.writeEndElement(); // Write the attributes and links that are represented as XML attributes, those need to go outside of the // "sequence" that contains the XML elements: type.declaredAttributes() .filter(x -> schemaNames.isRepresentedAsAttribute(x.getName())) .sorted() .forEach(this::writeStructMemberAsAttribute); type.declaredLinks() .filter(x -> schemaNames.isRepresentedAsAttribute(x.getName())) .sorted() .forEach(this::writeStructMemberAsAttribute); }
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); }
private void writeAttribute(Attribute attribute) { writer.writeStartElement("attribute"); writeCommon(attribute); writeTypeRef(attribute.getType()); writer.writeEndElement(); }
private void writeStructAttribute(Attribute attribute) { writer.writeStartObject(); writeCommon(attribute); writeTypeRef(attribute.getType()); writer.writeEnd(); }
/** * 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); }
if (attribute.isPresent()) { AttributeExpression replacement = new AttributeExpression(); replacement.setType(attribute.get().getType()); replacement.setTarget(target); replacement.setAttribute(attribute.get());
Attribute statusAttribute = new Attribute(); statusAttribute.setName(NameParser.parseUsingCase("Status")); statusAttribute.setType(model.getStringType()); statusAttribute.setDeclaringType(actionType); actionType.addAttribute(statusAttribute); Attribute faultAttribute = new Attribute(); faultAttribute.setName(NameParser.parseUsingCase("Fault")); faultAttribute.setType(model.getType(NameParser.parseUsingCase("Fault"))); faultAttribute.setDeclaringType(actionType); actionType.addAttribute(faultAttribute); Attribute gracePeriodAttribute = new Attribute(); gracePeriodAttribute.setName(NameParser.parseUsingCase("GracePeriod")); gracePeriodAttribute.setType(model.getType(NameParser.parseUsingCase("GracePeriod"))); gracePeriodAttribute.setDeclaringType(actionType); actionType.addAttribute(gracePeriodAttribute); Attribute jobAttribute = new Attribute(); jobAttribute.setName(NameParser.parseUsingCase("Job")); jobAttribute.setType(model.getType(NameParser.parseUsingCase("Job"))); jobAttribute.setDeclaringType(actionType); actionType.addAttribute(jobAttribute); Attribute parameterAttribute = new Attribute(); parameterAttribute.setName(parameter.getName()); parameterAttribute.setType(parameter.getType()); parameterAttribute.setDeclaringType(actionType); actionType.addAttribute(parameterAttribute);
attributes.stream().sorted().forEach(attribute -> { docBuffer.addLine("|`%s`", getName(attribute)); docBuffer.addLine("|%s", getLink(attribute.getType())); docBuffer.addLine("|%s", getSummary(attribute)); docBuffer.addLine();