@Test public void buildPropertyDoc() throws NoSuchMethodException, NoSuchFieldException { Field nameField = Person.class.getDeclaredField("name"); Field ageField = Person.class.getDeclaredField("age"); Field phoneField = Person.class.getDeclaredField("phone"); Method getName = Person.class.getDeclaredMethod("getName"); Method getAge = Person.class.getDeclaredMethod("getAge"); Method getPhone = Person.class.getDeclaredMethod("getPhone"); Property nameProp = new Property("name", String.class, getName); nameProp.setField(nameField); nameProp.setGetter(getName); Property ageProp = new Property("age", Integer.class, getAge); ageProp.setField(ageField); ageProp.setGetter(getAge); Property phoneProp = new Property("phone", String.class, getPhone); phoneProp.setField(phoneField); phoneProp.setGetter(getPhone); Optional<TypeDoc> doc = reader.buildTypeDocBase(Person.class, typeReferenceProvider, c -> null); assertTrue(doc.isPresent()); TypeDoc typeDoc = doc.get(); Optional<PropertyDoc> maybeNameDoc = reader.buildPropertyDoc(nameProp, typeDoc, typeReferenceProvider); Optional<PropertyDoc> maybeAgeDoc = reader.buildPropertyDoc(ageProp, typeDoc, typeReferenceProvider); Optional<PropertyDoc> maybePhoneDoc = reader.buildPropertyDoc(phoneProp, typeDoc, typeReferenceProvider); assertTrue(maybeNameDoc.isPresent()); assertTrue(maybeAgeDoc.isPresent()); assertTrue(maybePhoneDoc.isPresent()); PropertyDoc nameDoc = maybeNameDoc.get(); PropertyDoc ageDoc = maybeAgeDoc.get(); PropertyDoc phoneDoc = maybePhoneDoc.get(); assertEquals("name", nameDoc.getName()); assertEquals("age", ageDoc.getName()); assertEquals("phone", phoneDoc.getName()); assertEquals("The name of this <code>Person</code>.", nameDoc.getDescription()); assertEquals("this person's age", ageDoc.getDescription()); assertEquals("Gets this person's <code>phone number</code>.", phoneDoc.getDescription()); }
@NotNull @Override public Optional<PropertyDoc> buildPropertyDoc(Property property, TypeDoc parentDoc, TypeReferenceProvider typeReferenceProvider) { PropertyDoc doc = new PropertyDoc(); doc.setName(property.getName()); doc.setDescription(getPropertyDescription(property)); return Optional.of(doc); }
JavadocTypeDocReader implements TypeDocReader { @NotNull @Override public Optional<PropertyDoc> buildPropertyDoc(Property property, TypeDoc parentDoc, TypeReferenceProvider typeReferenceProvider) { PropertyDoc doc = new PropertyDoc(); doc.setName(property.getName()); doc.setDescription(getPropertyDescription(property)); return Optional.of(doc); } }
JavadocTypeDocReader implements TypeDocReader { @NotNull @Override public Optional<PropertyDoc> buildPropertyDoc(Property property, TypeDoc parentDoc, TypeReferenceProvider typeReferenceProvider) { PropertyDoc doc = new PropertyDoc(); doc.setName(property.getName()); doc.setDescription(getPropertyDescription(property)); return Optional.of(doc); }  }
JavadocTypeDocReader implements TypeDocReader { @NotNull @Override public Optional<PropertyDoc> buildPropertyDoc(Property property, TypeDoc parentDoc, TypeReferenceProvider typeReferenceProvider) { PropertyDoc doc = new PropertyDoc(); doc.setName(property.getName()); doc.setDescription(getPropertyDescription(property)); return Optional.of(doc); }  @NotNull @Override Optional<TypeDoc> buildTypeDocBase(@NotNull Class<?> clazz,
            @NotNull TypeReferenceProvider typeReferenceProvider, @NotNull TemplateProvider templateProvider); @NotNull @Override Optional<PropertyDoc> buildPropertyDoc(Property property, TypeDoc parentDoc,
            TypeReferenceProvider typeReferenceProvider); }
JavadocTypeDocReader implements TypeDocReader { @NotNull @Override public Optional<PropertyDoc> buildPropertyDoc(Property property, TypeDoc parentDoc, TypeReferenceProvider typeReferenceProvider) { PropertyDoc doc = new PropertyDoc(); doc.setName(property.getName()); doc.setDescription(getPropertyDescription(property)); return Optional.of(doc); }  @NotNull @Override Optional<TypeDoc> buildTypeDocBase(@NotNull Class<?> clazz,
            @NotNull TypeReferenceProvider typeReferenceProvider, @NotNull TemplateProvider templateProvider); @NotNull @Override Optional<PropertyDoc> buildPropertyDoc(Property property, TypeDoc parentDoc,
            TypeReferenceProvider typeReferenceProvider);  }