Last active
December 20, 2015 14:58
-
-
Save Nkzn/6150340 to your computer and use it in GitHub Desktop.
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
package jp.water_cell.sample.jpp_lombok.model; | |
import net.vvakame.util.jsonpullparser.annotation.JsonKey; | |
import net.vvakame.util.jsonpullparser.annotation.JsonModel; | |
import lombok.AllArgsConstructor; | |
import lombok.EqualsAndHashCode; | |
import lombok.Getter; | |
import lombok.NoArgsConstructor; | |
import lombok.Setter; | |
import lombok.ToString; | |
@Setter | |
@Getter | |
@NoArgsConstructor | |
@AllArgsConstructor | |
@EqualsAndHashCode | |
@ToString | |
@JsonModel | |
public class Fuga { | |
@JsonKey | |
Integer buz; | |
@JsonKey | |
Hoge hoge; | |
} |
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
package jp.water_cell.sample.jpp_lombok.model; | |
import net.vvakame.util.jsonpullparser.annotation.JsonKey; | |
import net.vvakame.util.jsonpullparser.annotation.JsonModel; | |
import lombok.AllArgsConstructor; | |
import lombok.EqualsAndHashCode; | |
import lombok.Getter; | |
import lombok.NoArgsConstructor; | |
import lombok.Setter; | |
import lombok.ToString; | |
@Setter | |
@Getter | |
@NoArgsConstructor | |
@AllArgsConstructor | |
@ToString | |
@EqualsAndHashCode | |
@JsonModel | |
public class Hoge { | |
@JsonKey | |
String foo; | |
@JsonKey | |
String bar; | |
} |
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
package jp.water_cell.sample.jpp_lombok; | |
import java.io.IOException; | |
import jp.water_cell.sample.jpp_lombok.model.Fuga; | |
import jp.water_cell.sample.jpp_lombok.model.FugaGen; | |
import jp.water_cell.sample.jpp_lombok.model.Hoge; | |
import net.vvakame.util.jsonpullparser.JsonFormatException; | |
public class Main { | |
public static void main(String[] args) throws IOException, JsonFormatException { | |
final String fugaJson = "{\"buz\": 1, \"hoge\": {\"foo\": \"fooValue\", \"bar\": \"barValue\"}}"; | |
final Fuga actual = FugaGen.get(fugaJson); | |
final Fuga expected = new Fuga(1, new Hoge("fooValue", "barValue")); | |
System.out.println("actual ->\t" + actual.toString()); | |
System.out.println("expected ->\t" + expected.toString()); | |
System.out.println("equals? ->\t" + actual.equals(expected)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment