1 package org.robolectric.annotation.processing; 2 3 import java.util.regex.Pattern; 4 5 public abstract class DocumentedElement { 6 private static final Pattern START_OR_NEWLINE_SPACE = Pattern.compile("(^|\n) "); 7 8 private final String name; 9 private String documentation; 10 DocumentedElement(String name)11 protected DocumentedElement(String name) { 12 this.name = name; 13 } 14 getName()15 public String getName() { 16 return name; 17 } 18 19 @Override toString()20 public String toString() { 21 return getClass().getSimpleName() + "{name='" + name + '\'' + '}'; 22 } 23 setDocumentation(String docStr)24 public void setDocumentation(String docStr) { 25 if (docStr != null) { 26 this.documentation = START_OR_NEWLINE_SPACE.matcher(docStr).replaceAll("$1"); 27 } 28 } 29 getDocumentation()30 public String getDocumentation() { 31 return documentation; 32 } 33 } 34