private void analyzeEnum(JavaClass javaClass) { // Create the type: EnumType type = new EnumType(); analyzeSource(javaClass, type); analyzeModule(javaClass, type); analyzeName(javaClass, type); analyzeAnnotations(javaClass, type); analyzeDocumentation(javaClass, type); // Get the values: javaClass.getEnumConstants().forEach(x -> analyzeEnumValue(x, type)); // Add the type to the model: model.addType(type); }
public Model() { // Create the anonymous module: Module anonymousModule = new Module(); anonymousModule.setModel(this); modules.add(anonymousModule); // Add the builtin types: booleanType = new PrimitiveType(); booleanType.setName(NameParser.parseUsingCase("Boolean")); booleanType.setModule(anonymousModule); addType(booleanType); stringType = new PrimitiveType(); stringType.setName(NameParser.parseUsingCase("String")); stringType.setModule(anonymousModule); addType(stringType); integerType = new PrimitiveType(); integerType.setName(NameParser.parseUsingCase("Integer")); integerType.setModule(anonymousModule); addType(integerType); dateType = new PrimitiveType(); dateType.setName(NameParser.parseUsingCase("Date")); dateType.setModule(anonymousModule); addType(dateType); decimalType = new PrimitiveType(); decimalType.setName(NameParser.parseUsingCase("Decimal")); decimalType.setModule(anonymousModule); addType(decimalType); }
assignType(typeName, listType::setElementType); listTypes.put(typeName, listType); model.addType(listType);
/** * 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); }
model.addType(actionType);
/** * 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); }