Skip to content

Commit 906e644

Browse files
committed
Clean up method ordering and section headers
See: http://imagej.net/Coding_style#Ordering_of_code_blocks
1 parent 0daddfb commit 906e644

File tree

3 files changed

+34
-26
lines changed

3 files changed

+34
-26
lines changed

src/main/java/org/scijava/AbstractGateway.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,15 @@ public String getTitle() {
274274
}
275275

276276
@Override
277-
public String getVersion() {
278-
return getApp().getVersion();
277+
public String getInfo(final boolean mem) {
278+
return getApp().getInfo(mem);
279279
}
280280

281+
// -- Versioned methods --
282+
281283
@Override
282-
public String getInfo(final boolean mem) {
283-
return getApp().getInfo(mem);
284+
public String getVersion() {
285+
return getApp().getVersion();
284286
}
285287

286288
}

src/main/java/org/scijava/app/AbstractApp.java

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,13 @@ public abstract class AbstractApp extends AbstractRichPlugin implements App {
5656
/** JAR manifest with metadata about the application. */
5757
private Manifest manifest;
5858

59+
// -- App methods --
60+
5961
@Override
6062
public String getTitle() {
6163
return getInfo().getName();
6264
}
6365

64-
@Override
65-
public String getVersion() {
66-
// NB: We do not use VersionUtils.getVersion(c, groupId, artifactId)
67-
// because that method does not cache the parsed Manifest and/or POM.
68-
// We might have them already parsed here, and if not, we want to
69-
// parse then cache locally, rather than discarding them afterwards.
70-
71-
// try the manifest first, since it might know its build number
72-
final Manifest m = getManifest();
73-
if (m != null) {
74-
final String v = m.getVersion();
75-
if (v != null) return v;
76-
}
77-
// try the POM
78-
final POM p = getPOM();
79-
if (p != null) {
80-
final String v = p.getVersion();
81-
if (v != null) return v;
82-
}
83-
return "Unknown";
84-
}
85-
8666
@Override
8767
public POM getPOM() {
8868
if (pom == null) {
@@ -145,4 +125,28 @@ public void quit() {
145125
getContext().dispose();
146126
}
147127

128+
// -- Versioned methods --
129+
130+
@Override
131+
public String getVersion() {
132+
// NB: We do not use VersionUtils.getVersion(c, groupId, artifactId)
133+
// because that method does not cache the parsed Manifest and/or POM.
134+
// We might have them already parsed here, and if not, we want to
135+
// parse then cache locally, rather than discarding them afterwards.
136+
137+
// try the manifest first, since it might know its build number
138+
final Manifest m = getManifest();
139+
if (m != null) {
140+
final String v = m.getVersion();
141+
if (v != null) return v;
142+
}
143+
// try the POM
144+
final POM p = getPOM();
145+
if (p != null) {
146+
final String v = p.getVersion();
147+
if (v != null) return v;
148+
}
149+
return "Unknown";
150+
}
151+
148152
}

src/main/java/org/scijava/script/ScriptInfo.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ public String getLocation() {
318318
return new File(path).toURI().normalize().toString();
319319
}
320320

321+
// -- Versioned methods --
322+
321323
@Override
322324
public String getVersion() {
323325
final File file = new File(path);

0 commit comments

Comments
 (0)