Skip to content

Commit

Permalink
Add missing getters/setters and fix hashcodes of modified classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pcampalani committed Nov 22, 2024
1 parent 03fc300 commit 8bebc0a
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ else if (TEMPORAL_AXIS_LABELS.contains(label)) {
if (null != bandWave) {
try {
double w = Double.parseDouble(bandWave);
bandsSummary.setCenterwavelength(w);
bandsSummary.setCenterWavelength(w);
} catch (NumberFormatException e) {
log.warn("Error in parsing band wave-lenght:" + e.getMessage());
}
Expand Down
68 changes: 44 additions & 24 deletions src/main/java/org/openeo/spring/model/BandSummary.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,14 @@ public class BandSummary {
private String description;

@JsonProperty(value="center_wavelength", required=false)
private Double centerwavelength;
private Double centerWavelength;

@JsonProperty(value="full_width_half_max", required=false)
private Double full_width_half_max;
private Double fullWidthHalfMax;

@JsonProperty(value="gsd", required=false)
private Double gsd;

public BandSummary name(String name) {
this.name = name;
return this;
}

/**
* Relationship between the current document and the linked document. SHOULD be a [registered link relation type](https://www.iana.org/assignments/link-relations/link-relations.xml) whenever feasible.
* @return rel
Expand All @@ -57,11 +52,6 @@ public void setName(String name) {
this.name = name;
}

public BandSummary commonname(String commonname) {
this.commonname = commonname;
return this;
}

/**
* The value MUST be a valid URL.
* @return href
Expand All @@ -85,22 +75,51 @@ public void setDescription(String description) {
this.description = description;
}

public BandSummary centerwavelength(double centerwavelength) {
this.centerwavelength = centerwavelength;
return this;
}

/**
* The value MUST be a string that hints at the format used to represent data at the provided URI, preferably a media (MIME) type.
* @return type
*/
@ApiModelProperty(example = "0.773", value = "The value MUST be a value that hints at the format used to represent data at the provided URI, preferably a media (MIME) type.")
public Double getCenterwavelength() {
return centerwavelength;
public Double getCenterWwavelength() {
return centerWavelength;
}

public void setCenterWavelength(Double centerwavelength) {
this.centerWavelength = centerwavelength;
}

@ApiModelProperty
public Double getFullWidthHalfMax() {
return fullWidthHalfMax;
}

public void setCenterwavelength(Double centerwavelength) {
this.centerwavelength = centerwavelength;
public void setFullWidthHalfMax(Double fullWidthHalfMax) {
this.fullWidthHalfMax = fullWidthHalfMax;
}

/*
* constructor builder helpers
*/

public BandSummary name(String name) {
this.name = name;
return this;
}

public BandSummary commonName(String commonname) {
this.commonname = commonname;
return this;
}

public BandSummary centerWavelength(double centerWavelength) {
this.centerWavelength = centerWavelength;
return this;
}

public BandSummary fullWidthHalfMax(double fullWidthHalfMax) {
this.fullWidthHalfMax = fullWidthHalfMax;
return this;
}

public BandSummary gsd(Double gsd) {
Expand Down Expand Up @@ -133,13 +152,14 @@ public boolean equals(java.lang.Object o) {
return Objects.equals(this.name, bandsummary.name) &&
Objects.equals(this.commonname, bandsummary.commonname) &&
Objects.equals(this.description, bandsummary.description) &&
Objects.equals(this.centerwavelength, bandsummary.centerwavelength) &&
Objects.equals(this.centerWavelength, bandsummary.centerWavelength) &&
Objects.equals(this.fullWidthHalfMax, bandsummary.fullWidthHalfMax) &&
Objects.equals(this.gsd, bandsummary.gsd);
}

@Override
public int hashCode() {
return Objects.hash(name, commonname, description, centerwavelength, gsd);
return Objects.hash(name, commonname, description, centerWavelength, fullWidthHalfMax, gsd);
}

@Override
Expand All @@ -150,7 +170,8 @@ public String toString() {
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" common_name: ").append(toIndentedString(commonname)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" center_wavelength: ").append(toIndentedString(centerwavelength)).append("\n");
sb.append(" center_wavelength: ").append(toIndentedString(centerWavelength)).append("\n");
sb.append(" full_width_half_max: ").append(toIndentedString(fullWidthHalfMax)).append("\n");
sb.append(" gsd: ").append(toIndentedString(gsd)).append("\n");
sb.append("}");
return sb.toString();
Expand All @@ -167,4 +188,3 @@ private String toIndentedString(java.lang.Object o) {
return o.toString().replace("\n", "\n ");
}
}

4 changes: 1 addition & 3 deletions src/main/java/org/openeo/spring/model/DimensionSpatial.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,8 @@ public DimensionSpatial referenceSystem(String referenceSystem) {
* The spatial reference system for the data, specified as [EPSG code](http://www.epsg-registry.org/), [WKT2 (ISO 19162) string](http://docs.opengeospatial.org/is/18-010r7/18-010r7.html) or [PROJ definition (deprecated)](https://proj.org/usage/quickstart.html). Defaults to EPSG code 4326.
* @return referenceSystem
*/
@ApiModelProperty(value = "The spatial reference system for the data, specified as [EPSG code](http://www.epsg-registry.org/), [WKT2 (ISO 19162) string](http://docs.opengeospatial.org/is/18-010r7/18-010r7.html) or [PROJ definition (deprecated)](https://proj.org/usage/quickstart.html). Defaults to EPSG code 4326.")

@ApiModelProperty(value = "The spatial reference system for the data, specified as [EPSG code](http://www.epsg-registry.org/), [WKT2 (ISO 19162) string](http://docs.opengeospatial.org/is/18-010r7/18-010r7.html) or [PROJ definition (deprecated)](https://proj.org/usage/quickstart.html). Defaults to EPSG code '4326'.")
@Valid

public String getReferenceSystem() {
return referenceSystem;
}
Expand Down
20 changes: 18 additions & 2 deletions src/main/java/org/openeo/spring/model/Link.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,20 @@ public void setTitle(String title) {
this.title = title;
}

@ApiModelProperty(example = "related", required = true, value = "Relationship between the current document and the linked document. SHOULD be a [registered link relation type](https://www.iana.org/assignments/link-relations/link-relations.xml) whenever feasible.")
public String getMethod() {
return method;
}

public void setMethod(String method) {
this.method = method;
}

public Link method(String method) {
this.method= method;
return this;
}

@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand All @@ -144,12 +158,13 @@ public boolean equals(java.lang.Object o) {
return Objects.equals(this.rel, link.rel) &&
Objects.equals(this.href, link.href) &&
Objects.equals(this.type, link.type) &&
Objects.equals(this.title, link.title);
Objects.equals(this.title, link.title) &&
Objects.equals(this.method, link.method);
}

@Override
public int hashCode() {
return Objects.hash(rel, href, type, title);
return Objects.hash(rel, href, type, title, method);
}

@Override
Expand All @@ -161,6 +176,7 @@ public String toString() {
sb.append(" href: ").append(toIndentedString(href)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" title: ").append(toIndentedString(title)).append("\n");
sb.append(" method: ").append(toIndentedString(method)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down

0 comments on commit 8bebc0a

Please sign in to comment.