3939 * @see InMemoryGeneratedFiles
4040 * @see FileSystemGeneratedFiles
4141 */
42- public abstract class GeneratedFiles {
42+ public interface GeneratedFiles {
4343
4444 /**
4545 * Add a generated {@link Kind#SOURCE source file} with content from the
4646 * given {@link JavaFile}.
4747 * @param javaFile the java file to add
4848 */
49- public void addSourceFile (JavaFile javaFile ) {
49+ default void addSourceFile (JavaFile javaFile ) {
5050 validatePackage (javaFile .packageName , javaFile .typeSpec .name );
5151 String className = javaFile .packageName + "." + javaFile .typeSpec .name ;
5252 addSourceFile (className , javaFile ::writeTo );
@@ -59,7 +59,7 @@ public void addSourceFile(JavaFile javaFile) {
5959 * of the file
6060 * @param content the contents of the file
6161 */
62- public void addSourceFile (String className , CharSequence content ) {
62+ default void addSourceFile (String className , CharSequence content ) {
6363 addSourceFile (className , appendable -> appendable .append (content ));
6464 }
6565
@@ -71,7 +71,7 @@ public void addSourceFile(String className, CharSequence content) {
7171 * @param content a {@link ThrowingConsumer} that accepts an
7272 * {@link Appendable} which will receive the file contents
7373 */
74- public void addSourceFile (String className , ThrowingConsumer <Appendable > content ) {
74+ default void addSourceFile (String className , ThrowingConsumer <Appendable > content ) {
7575 addFile (Kind .SOURCE , getClassNamePath (className ), content );
7676 }
7777
@@ -83,7 +83,7 @@ public void addSourceFile(String className, ThrowingConsumer<Appendable> content
8383 * @param content an {@link InputStreamSource} that will provide an input
8484 * stream containing the file contents
8585 */
86- public void addSourceFile (String className , InputStreamSource content ) {
86+ default void addSourceFile (String className , InputStreamSource content ) {
8787 addFile (Kind .SOURCE , getClassNamePath (className ), content );
8888 }
8989
@@ -93,7 +93,7 @@ public void addSourceFile(String className, InputStreamSource content) {
9393 * @param path the relative path of the file
9494 * @param content the contents of the file
9595 */
96- public void addResourceFile (String path , CharSequence content ) {
96+ default void addResourceFile (String path , CharSequence content ) {
9797 addResourceFile (path , appendable -> appendable .append (content ));
9898 }
9999
@@ -104,7 +104,7 @@ public void addResourceFile(String path, CharSequence content) {
104104 * @param content a {@link ThrowingConsumer} that accepts an
105105 * {@link Appendable} which will receive the file contents
106106 */
107- public void addResourceFile (String path , ThrowingConsumer <Appendable > content ) {
107+ default void addResourceFile (String path , ThrowingConsumer <Appendable > content ) {
108108 addFile (Kind .RESOURCE , path , content );
109109 }
110110
@@ -115,7 +115,7 @@ public void addResourceFile(String path, ThrowingConsumer<Appendable> content) {
115115 * @param content an {@link InputStreamSource} that will provide an input
116116 * stream containing the file contents
117117 */
118- public void addResourceFile (String path , InputStreamSource content ) {
118+ default void addResourceFile (String path , InputStreamSource content ) {
119119 addFile (Kind .RESOURCE , path , content );
120120 }
121121
@@ -126,7 +126,7 @@ public void addResourceFile(String path, InputStreamSource content) {
126126 * @param content an {@link InputStreamSource} that will provide an input
127127 * stream containing the file contents
128128 */
129- public void addClassFile (String path , InputStreamSource content ) {
129+ default void addClassFile (String path , InputStreamSource content ) {
130130 addFile (Kind .CLASS , path , content );
131131 }
132132
@@ -137,7 +137,7 @@ public void addClassFile(String path, InputStreamSource content) {
137137 * @param path the relative path of the file
138138 * @param content the contents of the file
139139 */
140- public void addFile (Kind kind , String path , CharSequence content ) {
140+ default void addFile (Kind kind , String path , CharSequence content ) {
141141 addFile (kind , path , appendable -> appendable .append (content ));
142142 }
143143
@@ -149,7 +149,7 @@ public void addFile(Kind kind, String path, CharSequence content) {
149149 * @param content a {@link ThrowingConsumer} that accepts an
150150 * {@link Appendable} which will receive the file contents
151151 */
152- public void addFile (Kind kind , String path , ThrowingConsumer <Appendable > content ) {
152+ default void addFile (Kind kind , String path , ThrowingConsumer <Appendable > content ) {
153153 Assert .notNull (content , "'content' must not be null" );
154154 addFile (kind , path , new AppendableConsumerInputStreamSource (content ));
155155 }
@@ -162,7 +162,7 @@ public void addFile(Kind kind, String path, ThrowingConsumer<Appendable> content
162162 * @param content an {@link InputStreamSource} that will provide an input
163163 * stream containing the file contents
164164 */
165- public void addFile (Kind kind , String path , InputStreamSource content ) {
165+ default void addFile (Kind kind , String path , InputStreamSource content ) {
166166 Assert .notNull (kind , "'kind' must not be null" );
167167 Assert .hasLength (path , "'path' must not be empty" );
168168 Assert .notNull (content , "'content' must not be null" );
@@ -179,7 +179,7 @@ public void addFile(Kind kind, String path, InputStreamSource content) {
179179 * @param handler a consumer of a {@link FileHandler} for the file
180180 * @since 6.2
181181 */
182- public abstract void handleFile (Kind kind , String path , ThrowingConsumer <FileHandler > handler );
182+ void handleFile (Kind kind , String path , ThrowingConsumer <FileHandler > handler );
183183
184184 private static String getClassNamePath (String className ) {
185185 Assert .hasLength (className , "'className' must not be empty" );
@@ -214,7 +214,7 @@ private static boolean isJavaIdentifier(String className) {
214214 /**
215215 * The various kinds of generated files that are supported.
216216 */
217- public enum Kind {
217+ enum Kind {
218218
219219 /**
220220 * A source file containing Java code that should be compiled.
@@ -241,7 +241,7 @@ public enum Kind {
241241 *
242242 * @since 6.2
243243 */
244- public abstract static class FileHandler {
244+ abstract class FileHandler {
245245
246246 private final boolean exists ;
247247
0 commit comments