mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-23 01:55:10 +00:00
Clean up
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:
parent
04bdd1d308
commit
1ada9a7ca3
2 changed files with 27 additions and 28 deletions
|
|
@ -17,26 +17,26 @@ import com.owlike.genson.annotation.JsonProperty;
|
|||
*/
|
||||
@DataType()
|
||||
public final class CarQueryResult {
|
||||
@Property()
|
||||
private final String key;
|
||||
|
||||
@Property()
|
||||
private final Car record;
|
||||
|
||||
public CarQueryResult(@JsonProperty("Key") final String key, @JsonProperty("Record") final Car record) {
|
||||
this.key = key;
|
||||
this.record = record;
|
||||
}
|
||||
|
||||
@Property()
|
||||
private final String key;
|
||||
|
||||
@Property()
|
||||
private final Car record;
|
||||
|
||||
public CarQueryResult(@JsonProperty("Key") final String key, @JsonProperty("Record") final Car record) {
|
||||
this.key = key;
|
||||
this.record = record;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
public Car getRecord() {
|
||||
return record;
|
||||
}
|
||||
public Car getRecord() {
|
||||
return record;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
|
|
@ -50,7 +50,7 @@ public final class CarQueryResult {
|
|||
|
||||
Boolean recordsAreEquals = this.getRecord().equals(other.getRecord());
|
||||
Boolean keysAreEquals = this.getKey().equals(other.getKey());
|
||||
|
||||
|
||||
return recordsAreEquals && keysAreEquals;
|
||||
}
|
||||
|
||||
|
|
@ -58,11 +58,10 @@ public final class CarQueryResult {
|
|||
public int hashCode() {
|
||||
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 + "}\"}";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,14 +146,14 @@ public final class FabCar implements ContractInterface {
|
|||
final String startKey = "CAR0";
|
||||
final String endKey = "CAR999";
|
||||
List<CarQueryResult> queryResults = new ArrayList<CarQueryResult>();
|
||||
|
||||
|
||||
QueryResultsIterator<KeyValue> results = stub.getStateByRange(startKey, endKey);
|
||||
|
||||
|
||||
for (KeyValue result: results) {
|
||||
|
||||
Car car = genson.deserialize(result.getStringValue(), Car.class);
|
||||
queryResults.add(new CarQueryResult(result.getKey(), car));
|
||||
}
|
||||
|
||||
CarQueryResult[] response = queryResults.toArray(new CarQueryResult[queryResults.size()]);
|
||||
|
||||
return response;
|
||||
|
|
|
|||
Loading…
Reference in a new issue