Skip to content

Commit 895dbc6

Browse files
committed
Manifest: Remove 'get' from accessor methods
1 parent 5948aa5 commit 895dbc6

File tree

2 files changed

+30
-31
lines changed

2 files changed

+30
-31
lines changed

scijava-meta/src/main/java/org/scijava/meta/Manifest.java

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,63 +58,63 @@ private Manifest(final java.util.jar.Manifest manifest) {
5858

5959
// -- Manifest methods --
6060

61-
public String getArchiverVersion() {
61+
public String archiverVersion() {
6262
return get("Archiver-Version");
6363
}
6464

65-
public String getBuildJdk() {
65+
public String buildJdk() {
6666
return get("Build-Jdk");
6767
}
6868

69-
public String getBuiltBy() {
69+
public String builtBy() {
7070
return get("Built-By");
7171
}
7272

73-
public String getCreatedBy() {
73+
public String createdBy() {
7474
return get("Created-By");
7575
}
7676

77-
public String getImplementationBuild() {
77+
public String implementationBuild() {
7878
return get("Implementation-Build");
7979
}
8080

81-
public String getImplementationDate() {
81+
public String implementationDate() {
8282
return get("Implementation-Date");
8383
}
8484

85-
public String getImplementationTitle() {
85+
public String implementationTitle() {
8686
return get("Implementation-Title");
8787
}
8888

89-
public String getImplementationVendor() {
89+
public String implementationVendor() {
9090
return get("Implementation-Vendor");
9191
}
9292

93-
public String getImplementationVendorId() {
93+
public String implementationVendorId() {
9494
return get("Implementation-Vendor-Id");
9595
}
9696

97-
public String getImplementationVersion() {
97+
public String implementationVersion() {
9898
return get("Implementation-Version");
9999
}
100100

101-
public String getManifestVersion() {
101+
public String manifestVersion() {
102102
return get("Manifest-Version");
103103
}
104104

105-
public String getPackage() {
105+
public String package_() {
106106
return get("Package");
107107
}
108108

109-
public String getSpecificationTitle() {
109+
public String specificationTitle() {
110110
return get("Specification-Title");
111111
}
112112

113-
public String getSpecificationVendor() {
113+
public String specificationVendor() {
114114
return get("Specification-Vendor");
115115
}
116116

117-
public String getSpecificationVersion() {
117+
public String specificationVersion() {
118118
return get("Specification-Version");
119119
}
120120

@@ -135,9 +135,9 @@ public Map<Object, Object> getAll() {
135135
// -- Utility methods --
136136

137137
/** Gets the JAR manifest associated with the given class. */
138-
public static Manifest getManifest(final Class<?> c) {
138+
public static Manifest manifest(final Class<?> c) {
139139
try {
140-
return getManifest(new URL("jar:" + Classes.location(c) + "!/"));
140+
return manifest(new URL("jar:" + Classes.location(c) + "!/"));
141141
}
142142
catch (final IOException e) {
143143
return null;
@@ -148,20 +148,20 @@ public static Manifest getManifest(final Class<?> c) {
148148
* Gets the JAR manifest associated with the given XML document. Assumes the
149149
* XML document was loaded as a resource from inside a JAR.
150150
*/
151-
public static Manifest getManifest(final XML xml) throws IOException {
151+
public static Manifest manifest(final XML xml) throws IOException {
152152
final String path = xml.path();
153153
if (path == null || !path.startsWith("file:")) return null;
154154
final int dotJAR = path.indexOf(".jar!/");
155-
return getManifest(new File(path.substring(5, dotJAR + 4)));
155+
return manifest(new File(path.substring(5, dotJAR + 4)));
156156
}
157157

158158
/** Gets the JAR manifest associated with the given JAR file. */
159-
public static Manifest getManifest(final File jarFile) throws IOException {
159+
public static Manifest manifest(final File jarFile) throws IOException {
160160
if (!jarFile.exists()) throw new FileNotFoundException();
161-
return getManifest(new URL("jar:file:" + jarFile.getAbsolutePath() + "!/"));
161+
return manifest(new URL("jar:file:" + jarFile.getAbsolutePath() + "!/"));
162162
}
163163

164-
private static Manifest getManifest(final URL jarURL) throws IOException {
164+
private static Manifest manifest(final URL jarURL) throws IOException {
165165
final JarURLConnection conn = (JarURLConnection) jarURL.openConnection();
166166
return new Manifest(conn.getManifest());
167167
}
@@ -170,20 +170,19 @@ private static Manifest getManifest(final URL jarURL) throws IOException {
170170

171171
@Override
172172
public String version() {
173-
final String v = getBaseVersion();
173+
final String v = baseVersion();
174174
if (v == null || !v.endsWith("-SNAPSHOT")) return v;
175175

176176
// append commit hash to differentiate between development versions
177-
final String buildNumber = getImplementationBuild();
177+
final String buildNumber = implementationBuild();
178178
return buildNumber == null ? v : v + "-" + buildNumber;
179179
}
180180

181181
// -- Helper methods --
182182

183-
private String getBaseVersion() {
184-
final String manifestVersion = getImplementationVersion();
183+
private String baseVersion() {
184+
final String manifestVersion = implementationVersion();
185185
if (manifestVersion != null) return manifestVersion;
186-
return getSpecificationVersion();
186+
return specificationVersion();
187187
}
188-
189188
}

scijava-meta/src/main/java/org/scijava/meta/Versions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static String classVersion(final Class<?> c, final String groupId, final
7979
* @return Version of specified {@link Class} or null if not found.
8080
*/
8181
public static String fromManifest(final Class<?> c) {
82-
final Manifest m = Manifest.getManifest(c);
82+
final Manifest m = Manifest.manifest(c);
8383
return m == null ? null : m.version();
8484
}
8585

@@ -107,8 +107,8 @@ public static String fromPOM(final Class<?> c, final String groupId, final Strin
107107
* @return Build number of specified {@link Class} or null if not found.
108108
*/
109109
public static String buildNumber(final Class<?> c) {
110-
final Manifest m = Manifest.getManifest(c);
111-
return m == null ? null : m.getImplementationBuild();
110+
final Manifest m = Manifest.manifest(c);
111+
return m == null ? null : m.implementationBuild();
112112
}
113113

114114
/**

0 commit comments

Comments
 (0)