-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
92 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,4 +121,5 @@ $RECYCLE.BIN/ | |
hs_err_pid* | ||
.idea | ||
*.iml | ||
reports | ||
reports | ||
.diffblue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
nitrite-v4/src/main/java/org/dizitart/no2/v4/jmh/ArbitraryDataConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.dizitart.no2.v4.jmh; | ||
|
||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
import org.dizitart.no2.collection.Document; | ||
import org.dizitart.no2.common.mapper.EntityConverter; | ||
import org.dizitart.no2.common.mapper.NitriteMapper; | ||
import org.dizitart.no2.repository.annotations.Id; | ||
|
||
/** | ||
* @author Anindya Chatterjee | ||
*/ | ||
@Data | ||
@Accessors(fluent = true, chain = true) | ||
public class ArbitraryDataConverter implements EntityConverter<ArbitraryData> { | ||
@Id | ||
private Integer id; | ||
private String text; | ||
private Double number1; | ||
private Double number2; | ||
private Integer index1; | ||
private Boolean flag1; | ||
private Boolean flag2; | ||
|
||
@Override | ||
public Class<ArbitraryData> getEntityType() { | ||
return ArbitraryData.class; | ||
} | ||
|
||
@Override | ||
public Document toDocument(ArbitraryData arbitraryData, NitriteMapper nitriteMapper) { | ||
return Document.createDocument("id", id) | ||
.put("text", text) | ||
.put("number1", number1) | ||
.put("number2", number2) | ||
.put("index1", index1) | ||
.put("flag1", flag1) | ||
.put("flag2", flag2); | ||
} | ||
|
||
@Override | ||
public ArbitraryData fromDocument(Document document, NitriteMapper nitriteMapper) { | ||
ArbitraryData arbitraryData = new ArbitraryData(); | ||
arbitraryData.id(document.get("id", Integer.class)); | ||
arbitraryData.text(document.get("text", String.class)); | ||
arbitraryData.number1(document.get("number1", Double.class)); | ||
arbitraryData.number2(document.get("number2", Double.class)); | ||
arbitraryData.index1(document.get("index1", Integer.class)); | ||
arbitraryData.flag1(document.get("flag1", Boolean.class)); | ||
arbitraryData.flag2(document.get("flag2", Boolean.class)); | ||
return arbitraryData; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.