Skip to content

Commit b87dd69

Browse files
gab1onectrueden
authored andcommitted
Location: add getName() method
The name returned is meant as an analogue to a file name and might be used for meta-data purposes. Signed-off-by: Curtis Rueden <ctrueden@wisc.edu>
1 parent 195438d commit b87dd69

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/org/scijava/io/location/Location.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
* </p>
4949
*
5050
* @author Curtis Rueden
51+
* @author Gabriel Einsdorf
5152
*/
5253
public interface Location {
5354

@@ -59,4 +60,13 @@ default URI getURI() {
5960
return null;
6061
}
6162

63+
/**
64+
* Gets the name of the object addressed by this location, or an empty string
65+
* if it has no name.
66+
*/
67+
default String getName() {
68+
final URI uri = getURI();
69+
return uri == null ? "" : uri.toString();
70+
}
71+
6272
}

0 commit comments

Comments
 (0)