mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 17:48:14 +08:00
Upgrade to spring-javaformat 0.0.6
This commit is contained in:
@@ -242,33 +242,34 @@ public class ProjectRequestDocument {
|
||||
public String toString() {
|
||||
return "ProjectRequestDocument [generationTimestamp=" + this.generationTimestamp
|
||||
+ ", "
|
||||
+ (this.requestIp != null ? "requestIp=" + this.requestIp + ", " : "")
|
||||
+ (this.requestIpv4 != null ? "requestIpv4=" + this.requestIpv4 + ", "
|
||||
+ ((this.requestIp != null) ? "requestIp=" + this.requestIp + ", " : "")
|
||||
+ ((this.requestIpv4 != null) ? "requestIpv4=" + this.requestIpv4 + ", "
|
||||
: "")
|
||||
+ (this.requestCountry != null
|
||||
+ ((this.requestCountry != null)
|
||||
? "requestCountry=" + this.requestCountry + ", " : "")
|
||||
+ (this.clientId != null ? "clientId=" + this.clientId + ", " : "")
|
||||
+ (this.clientVersion != null
|
||||
+ ((this.clientId != null) ? "clientId=" + this.clientId + ", " : "")
|
||||
+ ((this.clientVersion != null)
|
||||
? "clientVersion=" + this.clientVersion + ", " : "")
|
||||
+ (this.groupId != null ? "groupId=" + this.groupId + ", " : "")
|
||||
+ (this.artifactId != null ? "artifactId=" + this.artifactId + ", " : "")
|
||||
+ (this.packageName != null ? "packageName=" + this.packageName + ", "
|
||||
+ ((this.groupId != null) ? "groupId=" + this.groupId + ", " : "")
|
||||
+ ((this.artifactId != null) ? "artifactId=" + this.artifactId + ", "
|
||||
: "")
|
||||
+ (this.bootVersion != null ? "bootVersion=" + this.bootVersion + ", "
|
||||
+ ((this.packageName != null) ? "packageName=" + this.packageName + ", "
|
||||
: "")
|
||||
+ (this.javaVersion != null ? "javaVersion=" + this.javaVersion + ", "
|
||||
+ ((this.bootVersion != null) ? "bootVersion=" + this.bootVersion + ", "
|
||||
: "")
|
||||
+ (this.language != null ? "language=" + this.language + ", " : "")
|
||||
+ (this.packaging != null ? "packaging=" + this.packaging + ", " : "")
|
||||
+ (this.type != null ? "type=" + this.type + ", " : "")
|
||||
+ (this.dependencies != null ? "dependencies=" + this.dependencies + ", "
|
||||
: "")
|
||||
+ (this.errorMessage != null ? "errorMessage=" + this.errorMessage + ", "
|
||||
+ ((this.javaVersion != null) ? "javaVersion=" + this.javaVersion + ", "
|
||||
: "")
|
||||
+ ((this.language != null) ? "language=" + this.language + ", " : "")
|
||||
+ ((this.packaging != null) ? "packaging=" + this.packaging + ", " : "")
|
||||
+ ((this.type != null) ? "type=" + this.type + ", " : "")
|
||||
+ ((this.dependencies != null)
|
||||
? "dependencies=" + this.dependencies + ", " : "")
|
||||
+ ((this.errorMessage != null)
|
||||
? "errorMessage=" + this.errorMessage + ", " : "")
|
||||
+ "invalid=" + this.invalid + ", invalidJavaVersion="
|
||||
+ this.invalidJavaVersion + ", invalidLanguage=" + this.invalidLanguage
|
||||
+ ", invalidPackaging=" + this.invalidPackaging + ", invalidType="
|
||||
+ this.invalidType + ", " + (this.invalidDependencies != null
|
||||
+ this.invalidType + ", " + ((this.invalidDependencies != null)
|
||||
? "invalidDependencies=" + this.invalidDependencies : "")
|
||||
+ "]";
|
||||
}
|
||||
|
@@ -172,8 +172,8 @@ public class CommandLineHelpGenerator {
|
||||
.collect(Collectors.toList())) {
|
||||
String[] data = new String[3];
|
||||
data[0] = dep.getId();
|
||||
data[1] = (dep.getDescription() != null ? dep.getDescription()
|
||||
: dep.getName());
|
||||
data[1] = (dep.getDescription() != null) ? dep.getDescription()
|
||||
: dep.getName();
|
||||
data[2] = dep.getVersionRequirement();
|
||||
dependencyTable[i++] = data;
|
||||
}
|
||||
@@ -195,8 +195,8 @@ public class CommandLineHelpGenerator {
|
||||
.collect(Collectors.toList())) {
|
||||
String[] data = new String[typeTable[0].length];
|
||||
data[0] = (type.isDefault() ? type.getId() + " *" : type.getId());
|
||||
data[1] = (type.getDescription() != null ? type.getDescription()
|
||||
: type.getName());
|
||||
data[1] = (type.getDescription() != null) ? type.getDescription()
|
||||
: type.getName();
|
||||
if (addTags) {
|
||||
data[2] = buildTagRepresentation(type);
|
||||
}
|
||||
|
@@ -451,8 +451,8 @@ public class ProjectGenerator {
|
||||
model.put("bootTwoZeroAvailable", VERSION_2_0_0_M1.compareTo(bootVersion) <= 0);
|
||||
|
||||
// Gradle plugin has changed again as from 1.4.2
|
||||
model.put("springBootPluginName", (VERSION_1_4_2_M1.compareTo(bootVersion) <= 0
|
||||
? "org.springframework.boot" : "spring-boot"));
|
||||
model.put("springBootPluginName", (VERSION_1_4_2_M1.compareTo(bootVersion) <= 0)
|
||||
? "org.springframework.boot" : "spring-boot");
|
||||
|
||||
// New testing stuff
|
||||
model.put("newTestInfrastructure", isNewTestInfrastructureAvailable(request));
|
||||
@@ -493,9 +493,9 @@ public class ProjectGenerator {
|
||||
model.put("groupId", bom.getGroupId());
|
||||
model.put("artifactId", bom.getArtifactId());
|
||||
model.put("versionToken",
|
||||
(bom.getVersionProperty() != null ? "${"
|
||||
(bom.getVersionProperty() != null) ? "${"
|
||||
+ computeVersionProperty(request, bom.getVersionProperty()) + "}"
|
||||
: bom.getVersion()));
|
||||
: bom.getVersion());
|
||||
return model;
|
||||
}
|
||||
|
||||
|
@@ -135,8 +135,8 @@ public class ProjectRequest extends BasicProjectRequest {
|
||||
*/
|
||||
public void resolve(InitializrMetadata metadata) {
|
||||
List<String> depIds = (!getStyle().isEmpty() ? getStyle() : getDependencies());
|
||||
String actualBootVersion = (getBootVersion() != null ? getBootVersion()
|
||||
: metadata.getBootVersions().getDefault().getId());
|
||||
String actualBootVersion = (getBootVersion() != null) ? getBootVersion()
|
||||
: metadata.getBootVersions().getDefault().getId();
|
||||
Version requestedVersion = Version.parse(actualBootVersion);
|
||||
this.resolvedDependencies = depIds.stream().map((it) -> {
|
||||
Dependency dependency = metadata.getDependencies().get(it);
|
||||
@@ -324,12 +324,12 @@ public class ProjectRequest extends BasicProjectRequest {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectRequest [" + "parameters=" + this.parameters + ", "
|
||||
+ (this.resolvedDependencies != null
|
||||
+ ((this.resolvedDependencies != null)
|
||||
? "resolvedDependencies=" + this.resolvedDependencies + ", " : "")
|
||||
+ "boms=" + this.boms + ", " + "repositories=" + this.repositories + ", "
|
||||
+ "buildProperties=" + this.buildProperties + ", "
|
||||
+ (this.facets != null ? "facets=" + this.facets + ", " : "")
|
||||
+ (this.build != null ? "build=" + this.build : "") + "]";
|
||||
+ ((this.facets != null) ? "facets=" + this.facets + ", " : "")
|
||||
+ ((this.build != null) ? "build=" + this.build : "") + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -84,7 +84,7 @@ public class BillOfMaterials {
|
||||
|
||||
/**
|
||||
* Return the version of the BOM. Can be {@code null} if it is provided via a mapping.
|
||||
* @return The version of the BOM or {@code null}
|
||||
* @return the version of the BOM or {@code null}
|
||||
*/
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
@@ -208,15 +208,16 @@ public class BillOfMaterials {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BillOfMaterials ["
|
||||
+ (this.groupId != null ? "groupId=" + this.groupId + ", " : "")
|
||||
+ (this.artifactId != null ? "artifactId=" + this.artifactId + ", " : "")
|
||||
+ (this.version != null ? "version=" + this.version + ", " : "")
|
||||
+ (this.versionProperty != null
|
||||
+ ((this.groupId != null) ? "groupId=" + this.groupId + ", " : "")
|
||||
+ ((this.artifactId != null) ? "artifactId=" + this.artifactId + ", "
|
||||
: "")
|
||||
+ ((this.version != null) ? "version=" + this.version + ", " : "")
|
||||
+ ((this.versionProperty != null)
|
||||
? "versionProperty=" + this.versionProperty + ", " : "")
|
||||
+ (this.order != null ? "order=" + this.order + ", " : "")
|
||||
+ (this.additionalBoms != null
|
||||
+ ((this.order != null) ? "order=" + this.order + ", " : "")
|
||||
+ ((this.additionalBoms != null)
|
||||
? "additionalBoms=" + this.additionalBoms + ", " : "")
|
||||
+ (this.repositories != null ? "repositories=" + this.repositories : "")
|
||||
+ ((this.repositories != null) ? "repositories=" + this.repositories : "")
|
||||
+ "]";
|
||||
}
|
||||
|
||||
@@ -310,14 +311,14 @@ public class BillOfMaterials {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Mapping ["
|
||||
+ (this.versionRange != null
|
||||
+ ((this.versionRange != null)
|
||||
? "versionRange=" + this.versionRange + ", " : "")
|
||||
+ (this.version != null ? "version=" + this.version + ", " : "")
|
||||
+ (this.repositories != null
|
||||
+ ((this.version != null) ? "version=" + this.version + ", " : "")
|
||||
+ ((this.repositories != null)
|
||||
? "repositories=" + this.repositories + ", " : "")
|
||||
+ (this.additionalBoms != null
|
||||
+ ((this.additionalBoms != null)
|
||||
? "additionalBoms=" + this.additionalBoms + ", " : "")
|
||||
+ (this.range != null ? "range=" + this.range : "") + "]";
|
||||
+ ((this.range != null) ? "range=" + this.range : "") + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ package io.spring.initializr.metadata;
|
||||
/**
|
||||
* Metadata with a default value.
|
||||
*
|
||||
* @param <T> The value type
|
||||
* @param <T> the value type
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public interface Defaultable<T> {
|
||||
|
@@ -253,12 +253,12 @@ public class Dependency extends MetadataElement implements Describable {
|
||||
for (Mapping mapping : this.mappings) {
|
||||
if (mapping.range.match(bootVersion)) {
|
||||
Dependency dependency = new Dependency(this);
|
||||
dependency.groupId = (mapping.groupId != null ? mapping.groupId
|
||||
: this.groupId);
|
||||
dependency.artifactId = (mapping.artifactId != null ? mapping.artifactId
|
||||
: this.artifactId);
|
||||
dependency.version = (mapping.version != null ? mapping.version
|
||||
: this.version);
|
||||
dependency.groupId = (mapping.groupId != null) ? mapping.groupId
|
||||
: this.groupId;
|
||||
dependency.artifactId = (mapping.artifactId != null) ? mapping.artifactId
|
||||
: this.artifactId;
|
||||
dependency.version = (mapping.version != null) ? mapping.version
|
||||
: this.version;
|
||||
dependency.versionRequirement = mapping.range.toString();
|
||||
dependency.mappings = null;
|
||||
return dependency;
|
||||
@@ -327,7 +327,7 @@ public class Dependency extends MetadataElement implements Describable {
|
||||
/**
|
||||
* Return the default version, can be {@code null} to indicate that the version is
|
||||
* managed by the project and does not need to be specified.
|
||||
* @return The default version or {@code null}
|
||||
* @return the default version or {@code null}
|
||||
*/
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
@@ -465,7 +465,7 @@ public class Dependency extends MetadataElement implements Describable {
|
||||
dependency.groupId = groupId;
|
||||
dependency.artifactId = artifactId;
|
||||
dependency.version = version;
|
||||
dependency.scope = (scope != null ? scope : SCOPE_COMPILE);
|
||||
dependency.scope = (scope != null) ? scope : SCOPE_COMPILE;
|
||||
return dependency;
|
||||
}
|
||||
|
||||
|
@@ -66,7 +66,7 @@ public class InitializrConfiguration {
|
||||
* <p>
|
||||
* No suitable application name can be generated if the name is {@code null} or if it
|
||||
* contains an invalid character for a class identifier.
|
||||
* @param name The the source name
|
||||
* @param name the the source name
|
||||
* @return the generated application name
|
||||
* @see Env#getFallbackApplicationName()
|
||||
* @see Env#getInvalidApplicationNames()
|
||||
@@ -98,7 +98,7 @@ public class InitializrConfiguration {
|
||||
* <p>
|
||||
* The package name cannot be cleaned if the specified {@code packageName} is
|
||||
* {@code null} or if it contains an invalid character for a class identifier.
|
||||
* @param packageName The package name
|
||||
* @param packageName the package name
|
||||
* @param defaultPackageName the default package name
|
||||
* @return the cleaned package name
|
||||
* @see Env#getInvalidPackageNames()
|
||||
@@ -514,7 +514,7 @@ public class InitializrConfiguration {
|
||||
/**
|
||||
* Resolve the parent pom to use. If no custom parent pom is set, the standard
|
||||
* spring boot parent pom with the specified {@code bootVersion} is used.
|
||||
* @param bootVersion The Spring Boot version
|
||||
* @param bootVersion the Spring Boot version
|
||||
* @return the parent POM
|
||||
*/
|
||||
public ParentPom resolveParentPom(String bootVersion) {
|
||||
|
@@ -274,7 +274,7 @@ public class InitializrMetadata {
|
||||
private static String defaultId(
|
||||
Defaultable<? extends DefaultMetadataElement> element) {
|
||||
DefaultMetadataElement defaultValue = element.getDefault();
|
||||
return (defaultValue != null ? defaultValue.getId() : null);
|
||||
return (defaultValue != null) ? defaultValue.getId() : null;
|
||||
}
|
||||
|
||||
private static class ArtifactIdCapability extends TextCapability {
|
||||
@@ -289,7 +289,7 @@ public class InitializrMetadata {
|
||||
@Override
|
||||
public String getContent() {
|
||||
String value = super.getContent();
|
||||
return (value != null ? value : this.nameCapability.getContent());
|
||||
return (value != null) ? value : this.nameCapability.getContent();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -98,8 +98,8 @@ public final class InitializrMetadataBuilder {
|
||||
* @return a new {@link InitializrMetadata} instance
|
||||
*/
|
||||
public InitializrMetadata build() {
|
||||
InitializrConfiguration config = (this.configuration != null ? this.configuration
|
||||
: new InitializrConfiguration());
|
||||
InitializrConfiguration config = (this.configuration != null) ? this.configuration
|
||||
: new InitializrConfiguration();
|
||||
InitializrMetadata metadata = createInstance(config);
|
||||
for (InitializrMetadataCustomizer customizer : this.customizers) {
|
||||
customizer.customize(metadata);
|
||||
|
@@ -46,7 +46,7 @@ public class MetadataElement {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return (this.name != null ? this.name : this.id);
|
||||
return (this.name != null) ? this.name : this.id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
@@ -65,23 +65,6 @@ public class Repository {
|
||||
this.snapshotsEnabled = snapshotsEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Repository [" + (this.name != null ? "name=" + this.name + ", " : "")
|
||||
+ (this.url != null ? "url=" + this.url + ", " : "") + "snapshotsEnabled="
|
||||
+ this.snapshotsEnabled + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.name == null) ? 0 : this.name.hashCode());
|
||||
result = prime * result + (this.snapshotsEnabled ? 1231 : 1237);
|
||||
result = prime * result + ((this.url == null) ? 0 : this.url.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
@@ -116,4 +99,21 @@ public class Repository {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.name == null) ? 0 : this.name.hashCode());
|
||||
result = prime * result + (this.snapshotsEnabled ? 1231 : 1237);
|
||||
result = prime * result + ((this.url == null) ? 0 : this.url.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Repository [" + ((this.name != null) ? "name=" + this.name + ", " : "")
|
||||
+ ((this.url != null) ? "url=" + this.url + ", " : "")
|
||||
+ "snapshotsEnabled=" + this.snapshotsEnabled + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ import org.springframework.util.StringUtils;
|
||||
* Defines a capability of the initializr service. Each capability is defined by a id and
|
||||
* a {@link ServiceCapabilityType type}.
|
||||
*
|
||||
* @param <T> The content type
|
||||
* @param <T> the content type
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@JsonIgnoreProperties({ "default", "all" })
|
||||
|
@@ -82,14 +82,6 @@ public final class Version implements Serializable, Comparable<Version> {
|
||||
return this.qualifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.major + "." + this.minor + "." + this.patch
|
||||
+ (this.qualifier != null ? "." + this.qualifier.qualifier
|
||||
+ (this.qualifier.version != null ? this.qualifier.version : "")
|
||||
: "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the string representation of a {@link Version}. Throws an
|
||||
* {@link InvalidVersionException} if the version could not be parsed.
|
||||
@@ -140,23 +132,11 @@ public final class Version implements Serializable, Comparable<Version> {
|
||||
}
|
||||
|
||||
private static int safeCompare(Integer first, Integer second) {
|
||||
Integer firstIndex = (first != null ? first : 0);
|
||||
Integer secondIndex = (second != null ? second : 0);
|
||||
Integer firstIndex = (first != null) ? first : 0;
|
||||
Integer secondIndex = (second != null) ? second : 0;
|
||||
return firstIndex.compareTo(secondIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.major == null) ? 0 : this.major.hashCode());
|
||||
result = prime * result + ((this.minor == null) ? 0 : this.minor.hashCode());
|
||||
result = prime * result + ((this.patch == null) ? 0 : this.patch.hashCode());
|
||||
result = prime * result
|
||||
+ ((this.qualifier == null) ? 0 : this.qualifier.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
@@ -204,6 +184,26 @@ public final class Version implements Serializable, Comparable<Version> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.major == null) ? 0 : this.major.hashCode());
|
||||
result = prime * result + ((this.minor == null) ? 0 : this.minor.hashCode());
|
||||
result = prime * result + ((this.patch == null) ? 0 : this.patch.hashCode());
|
||||
result = prime * result
|
||||
+ ((this.qualifier == null) ? 0 : this.qualifier.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.major + "." + this.minor + "." + this.patch
|
||||
+ ((this.qualifier != null) ? "." + this.qualifier.qualifier
|
||||
+ ((this.qualifier.version != null) ? this.qualifier.version : "")
|
||||
: "");
|
||||
}
|
||||
|
||||
/**
|
||||
* A version qualifier.
|
||||
*/
|
||||
@@ -233,24 +233,6 @@ public final class Version implements Serializable, Comparable<Version> {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Qualifier ["
|
||||
+ (this.qualifier != null ? "qualifier=" + this.qualifier + ", " : "")
|
||||
+ (this.version != null ? "version=" + this.version : "") + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((this.qualifier == null) ? 0 : this.qualifier.hashCode());
|
||||
result = prime * result
|
||||
+ ((this.version == null) ? 0 : this.version.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
@@ -282,6 +264,25 @@ public final class Version implements Serializable, Comparable<Version> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((this.qualifier == null) ? 0 : this.qualifier.hashCode());
|
||||
result = prime * result
|
||||
+ ((this.version == null) ? 0 : this.version.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Qualifier ["
|
||||
+ ((this.qualifier != null) ? "qualifier=" + this.qualifier + ", "
|
||||
: "")
|
||||
+ ((this.version != null) ? "version=" + this.version : "") + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class VersionQualifierComparator implements Comparator<Qualifier> {
|
||||
@@ -296,17 +297,17 @@ public final class Version implements Serializable, Comparable<Version> {
|
||||
|
||||
@Override
|
||||
public int compare(Qualifier o1, Qualifier o2) {
|
||||
Qualifier first = (o1 != null ? o1 : new Qualifier(RELEASE));
|
||||
Qualifier second = (o2 != null ? o2 : new Qualifier(RELEASE));
|
||||
Qualifier first = (o1 != null) ? o1 : new Qualifier(RELEASE);
|
||||
Qualifier second = (o2 != null) ? o2 : new Qualifier(RELEASE);
|
||||
|
||||
int qualifier = compareQualifier(first, second);
|
||||
return (qualifier != 0 ? qualifier : compareQualifierVersion(first, second));
|
||||
return (qualifier != 0) ? qualifier : compareQualifierVersion(first, second);
|
||||
}
|
||||
|
||||
private static int compareQualifierVersion(Qualifier first, Qualifier second) {
|
||||
Integer firstVersion = (first.getVersion() != null ? first.getVersion() : 0);
|
||||
Integer secondVersion = (second.getVersion() != null ? second.getVersion()
|
||||
: 0);
|
||||
Integer firstVersion = (first.getVersion() != null) ? first.getVersion() : 0;
|
||||
Integer secondVersion = (second.getVersion() != null) ? second.getVersion()
|
||||
: 0;
|
||||
return firstVersion.compareTo(secondVersion);
|
||||
}
|
||||
|
||||
|
@@ -159,7 +159,7 @@ public class VersionParser {
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList());
|
||||
return (matches.size() != 1 ? null : matches.get(0));
|
||||
return (matches.size() != 1) ? null : matches.get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -82,11 +82,6 @@ public class VersionProperty implements Serializable, Comparable<VersionProperty
|
||||
return this.property.compareTo(o.property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.property;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@@ -106,4 +101,9 @@ public class VersionProperty implements Serializable, Comparable<VersionProperty
|
||||
return this.property.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.property;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -121,32 +121,6 @@ public class VersionRange {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (this.lowerVersion != null) {
|
||||
sb.append(this.lowerInclusive ? ">=" : ">").append(this.lowerVersion);
|
||||
}
|
||||
if (this.higherVersion != null) {
|
||||
sb.append(" and ").append(this.higherInclusive ? "<=" : "<")
|
||||
.append(this.higherVersion);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (this.higherInclusive ? 1231 : 1237);
|
||||
result = prime * result
|
||||
+ ((this.higherVersion == null) ? 0 : this.higherVersion.hashCode());
|
||||
result = prime * result + (this.lowerInclusive ? 1231 : 1237);
|
||||
result = prime * result
|
||||
+ ((this.lowerVersion == null) ? 0 : this.lowerVersion.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
@@ -184,4 +158,30 @@ public class VersionRange {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (this.higherInclusive ? 1231 : 1237);
|
||||
result = prime * result
|
||||
+ ((this.higherVersion == null) ? 0 : this.higherVersion.hashCode());
|
||||
result = prime * result + (this.lowerInclusive ? 1231 : 1237);
|
||||
result = prime * result
|
||||
+ ((this.lowerVersion == null) ? 0 : this.lowerVersion.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (this.lowerVersion != null) {
|
||||
sb.append(this.lowerInclusive ? ">=" : ">").append(this.lowerVersion);
|
||||
}
|
||||
if (this.higherVersion != null) {
|
||||
sb.append(" and ").append(this.higherInclusive ? "<=" : "<")
|
||||
.append(this.higherVersion);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -76,7 +76,7 @@ public class InitializrAutoConfiguration {
|
||||
public InitializrAutoConfiguration(
|
||||
ObjectProvider<List<ProjectRequestPostProcessor>> postProcessors) {
|
||||
List<ProjectRequestPostProcessor> list = postProcessors.getIfAvailable();
|
||||
this.postProcessors = (list != null ? list : new ArrayList<>());
|
||||
this.postProcessors = (list != null) ? list : new ArrayList<>();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@@ -74,7 +74,7 @@ public class DependencyMetadataV21JsonMapper implements DependencyMetadataJsonMa
|
||||
private static JsonNode mapRepository(Repository repo) {
|
||||
ObjectNode node = nodeFactory.objectNode();
|
||||
node.put("name", repo.getName())
|
||||
.put("url", (repo.getUrl() != null ? repo.getUrl().toString() : null))
|
||||
.put("url", (repo.getUrl() != null) ? repo.getUrl().toString() : null)
|
||||
.put("snapshotEnabled", repo.isSnapshotsEnabled());
|
||||
return node;
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ public interface InitializrMetadataJsonMapper {
|
||||
|
||||
/**
|
||||
* Write a json representation of the specified metadata.
|
||||
* @param metadata The intializr metadata
|
||||
* @param metadata the initializr metadata
|
||||
* @param appUrl the app URL
|
||||
* @return the JSON representation
|
||||
*/
|
||||
|
@@ -65,7 +65,7 @@ public class InitializrMetadataV21JsonMapper extends InitializrMetadataV2JsonMap
|
||||
}
|
||||
|
||||
private ObjectNode dependenciesLink(String appUrl) {
|
||||
String uri = (appUrl != null ? appUrl + "/dependencies" : "/dependencies");
|
||||
String uri = (appUrl != null) ? appUrl + "/dependencies" : "/dependencies";
|
||||
UriTemplate uriTemplate = new UriTemplate(uri, this.dependenciesVariables);
|
||||
ObjectNode result = nodeFactory().objectNode();
|
||||
result.put("href", uriTemplate.toString());
|
||||
|
@@ -114,7 +114,7 @@ public class InitializrMetadataV2JsonMapper implements InitializrMetadataJsonMap
|
||||
}
|
||||
|
||||
private String generateTemplatedUri(String appUrl, Type type) {
|
||||
String uri = (appUrl != null ? appUrl + type.getAction() : type.getAction());
|
||||
String uri = (appUrl != null) ? appUrl + type.getAction() : type.getAction();
|
||||
uri = uri + "?type=" + type.getId();
|
||||
UriTemplate uriTemplate = new UriTemplate(uri, this.templateVariables);
|
||||
return uriTemplate.toString();
|
||||
|
@@ -52,7 +52,7 @@ public abstract class AbstractInitializrController {
|
||||
this.metadataProvider = metadataProvider;
|
||||
this.linkTo = (link) -> {
|
||||
String result = resourceUrlProvider.getForLookupPath(link);
|
||||
return (result != null ? result : link);
|
||||
return (result != null) ? result : link;
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -206,8 +206,8 @@ public class MainController extends AbstractInitializrController {
|
||||
private ResponseEntity<String> dependenciesFor(InitializrMetadataVersion version,
|
||||
String bootVersion) {
|
||||
InitializrMetadata metadata = this.metadataProvider.get();
|
||||
Version v = (bootVersion != null ? Version.parse(bootVersion)
|
||||
: Version.parse(metadata.getBootVersions().getDefault().getId()));
|
||||
Version v = (bootVersion != null) ? Version.parse(bootVersion)
|
||||
: Version.parse(metadata.getBootVersions().getDefault().getId());
|
||||
DependencyMetadata dependencyMetadata = this.dependencyMetadataProvider
|
||||
.get(metadata, v);
|
||||
String content = new DependencyMetadataV21JsonMapper().write(dependencyMetadata);
|
||||
@@ -339,8 +339,8 @@ public class MainController extends AbstractInitializrController {
|
||||
|
||||
private static String getWrapperScript(ProjectRequest request) {
|
||||
String script = ("gradle".equals(request.getBuild()) ? "gradlew" : "mvnw");
|
||||
return (request.getBaseDir() != null ? request.getBaseDir() + "/" + script
|
||||
: script);
|
||||
return (request.getBaseDir() != null) ? request.getBaseDir() + "/" + script
|
||||
: script;
|
||||
}
|
||||
|
||||
private ResponseEntity<byte[]> upload(File download, File dir, String fileName,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2018 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -202,7 +202,7 @@ final class JsonFieldProcessor {
|
||||
List<String> segments, Match parent) {
|
||||
this.payload = payload;
|
||||
this.path = path;
|
||||
this.segments = (segments != null ? segments : path.getSegments());
|
||||
this.segments = (segments != null) ? segments : path.getSegments();
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
4
pom.xml
4
pom.xml
@@ -41,7 +41,7 @@
|
||||
<java.version>1.8</java.version>
|
||||
<spring.boot.version>2.0.4.RELEASE</spring.boot.version>
|
||||
<spring-cloud-contract.version>2.0.0.RELEASE</spring-cloud-contract.version>
|
||||
<spring-javaformat.version>0.0.3</spring-javaformat.version>
|
||||
<spring-javaformat.version>0.0.6</spring-javaformat.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
@@ -157,7 +157,7 @@
|
||||
<dependency>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>8.8</version>
|
||||
<version>8.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.spring.javaformat</groupId>
|
||||
|
Reference in New Issue
Block a user