Use always whitespaces to indent the start of the line
Remove unnecessary whitespaces

Signed-off-by: Stefan Obermeier <scray@stefan-obermeier.de>
This commit is contained in:
Stefan Obermeier 2020-04-06 23:32:55 +02:00
parent 04bdd1d308
commit 1ada9a7ca3
No known key found for this signature in database
GPG key ID: FEE0FA3967170C38
2 changed files with 27 additions and 28 deletions

View file

@ -17,26 +17,26 @@ import com.owlike.genson.annotation.JsonProperty;
*/ */
@DataType() @DataType()
public final class CarQueryResult { public final class CarQueryResult {
@Property() @Property()
private final String key; private final String key;
@Property() @Property()
private final Car record; private final Car record;
public CarQueryResult(@JsonProperty("Key") final String key, @JsonProperty("Record") final Car record) { public CarQueryResult(@JsonProperty("Key") final String key, @JsonProperty("Record") final Car record) {
this.key = key; this.key = key;
this.record = record; this.record = record;
} }
public String getKey() { public String getKey() {
return key; return key;
} }
public Car getRecord() { public Car getRecord() {
return record; return record;
} }
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
@ -50,7 +50,7 @@ public final class CarQueryResult {
Boolean recordsAreEquals = this.getRecord().equals(other.getRecord()); Boolean recordsAreEquals = this.getRecord().equals(other.getRecord());
Boolean keysAreEquals = this.getKey().equals(other.getKey()); Boolean keysAreEquals = this.getKey().equals(other.getKey());
return recordsAreEquals && keysAreEquals; return recordsAreEquals && keysAreEquals;
} }
@ -58,11 +58,10 @@ public final class CarQueryResult {
public int hashCode() { public int hashCode() {
return Objects.hash(this.getKey(), this.getRecord()); return Objects.hash(this.getKey(), this.getRecord());
} }
@Override
public String toString() {
return "{\"Key\":\"" + key + "\"" + "\"Record\":{\"" + record + "}\"}";
}
}
@Override
public String toString() {
return "{\"Key\":\"" + key + "\"" + "\"Record\":{\"" + record + "}\"}";
}
}

View file

@ -146,14 +146,14 @@ public final class FabCar implements ContractInterface {
final String startKey = "CAR0"; final String startKey = "CAR0";
final String endKey = "CAR999"; final String endKey = "CAR999";
List<CarQueryResult> queryResults = new ArrayList<CarQueryResult>(); List<CarQueryResult> queryResults = new ArrayList<CarQueryResult>();
QueryResultsIterator<KeyValue> results = stub.getStateByRange(startKey, endKey); QueryResultsIterator<KeyValue> results = stub.getStateByRange(startKey, endKey);
for (KeyValue result: results) { for (KeyValue result: results) {
Car car = genson.deserialize(result.getStringValue(), Car.class); Car car = genson.deserialize(result.getStringValue(), Car.class);
queryResults.add(new CarQueryResult(result.getKey(), car)); queryResults.add(new CarQueryResult(result.getKey(), car));
} }
CarQueryResult[] response = queryResults.toArray(new CarQueryResult[queryResults.size()]); CarQueryResult[] response = queryResults.toArray(new CarQueryResult[queryResults.size()]);
return response; return response;