Skip to content

Commit a959e2b

Browse files
committed
TextFormat: push default method impls to iface
Thank you Java 8.
1 parent 4ab6b51 commit a959e2b

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/main/java/org/scijava/text/AbstractTextFormat.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import java.io.File;
3535

3636
import org.scijava.plugin.AbstractHandlerPlugin;
37-
import org.scijava.util.FileUtils;
3837

3938
/**
4039
* Abstract superclass of {@link TextFormat} implementations.
@@ -44,20 +43,5 @@
4443
public abstract class AbstractTextFormat extends AbstractHandlerPlugin<File>
4544
implements TextFormat
4645
{
47-
48-
// -- Typed methods --
49-
50-
@Override
51-
public boolean supports(final File file) {
52-
for (final String ext : getExtensions()) {
53-
if (FileUtils.getExtension(file).equalsIgnoreCase(ext)) return true;
54-
}
55-
return false;
56-
}
57-
58-
@Override
59-
public Class<File> getType() {
60-
return File.class;
61-
}
62-
46+
// NB: No implementation needed.
6347
}

src/main/java/org/scijava/text/TextFormat.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
import org.scijava.plugin.HandlerPlugin;
3838
import org.scijava.plugin.Plugin;
39+
import org.scijava.util.FileUtils;
3940

4041
/**
4142
* {@code TextFormat} is a plugin that provides handling for a text markup
@@ -60,4 +61,19 @@ public interface TextFormat extends HandlerPlugin<File> {
6061
/** Expresses the given text string in HTML format. */
6162
String asHTML(String text);
6263

64+
// -- Typed methods --
65+
66+
@Override
67+
default boolean supports(final File file) {
68+
for (final String ext : getExtensions()) {
69+
if (FileUtils.getExtension(file).equalsIgnoreCase(ext)) return true;
70+
}
71+
return false;
72+
}
73+
74+
@Override
75+
default Class<File> getType() {
76+
return File.class;
77+
}
78+
6379
}

0 commit comments

Comments
 (0)