From 9cc1ea61c484f368a9af7c858eff671d349b345a Mon Sep 17 00:00:00 2001 From: cacard Date: Fri, 19 Jun 2020 10:39:32 +0800 Subject: [PATCH 1/2] test --- test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +1 \ No newline at end of file From 310a2d5422c347f16e4fda1ebaf3dc1ea2025cac Mon Sep 17 00:00:00 2001 From: cacard Date: Fri, 19 Jun 2020 13:16:49 +0800 Subject: [PATCH 2/2] init --- .gitignore | 2 + JsonToJava-Lib/.gitignore | 1 + JsonToJava-Lib/JsonToJava-Lib.iml | 56 +++++++++++++++++ com/example/api/model/Datum.java | 89 +++++++++++++++++++++++++++ com/example/api/model/Gen.java | 37 +++++++++++ com/example/api/model/ResHeader.java | 36 +++++++++++ com/example/api/model2/Datum.java | 89 +++++++++++++++++++++++++++ com/example/api/model2/Pojo3.java | 37 +++++++++++ com/example/api/model2/ResHeader.java | 36 +++++++++++ json/1.json | 1 + json/2.json | 1 + json/3.json | 1 + 12 files changed, 386 insertions(+) create mode 100644 JsonToJava-Lib/JsonToJava-Lib.iml create mode 100644 com/example/api/model/Datum.java create mode 100644 com/example/api/model/Gen.java create mode 100644 com/example/api/model/ResHeader.java create mode 100644 com/example/api/model2/Datum.java create mode 100644 com/example/api/model2/Pojo3.java create mode 100644 com/example/api/model2/ResHeader.java create mode 100644 json/1.json create mode 100644 json/2.json create mode 100644 json/3.json diff --git a/.gitignore b/.gitignore index d3f5d3e..004288c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ gen/ # Local configuration file (sdk path, etc) local.properties + +.idea \ No newline at end of file diff --git a/JsonToJava-Lib/.gitignore b/JsonToJava-Lib/.gitignore index 5e56e04..26f350b 100644 --- a/JsonToJava-Lib/.gitignore +++ b/JsonToJava-Lib/.gitignore @@ -1 +1,2 @@ /bin +.idea \ No newline at end of file diff --git a/JsonToJava-Lib/JsonToJava-Lib.iml b/JsonToJava-Lib/JsonToJava-Lib.iml new file mode 100644 index 0000000..6ea832b --- /dev/null +++ b/JsonToJava-Lib/JsonToJava-Lib.iml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/com/example/api/model/Datum.java b/com/example/api/model/Datum.java new file mode 100644 index 0000000..cf56e44 --- /dev/null +++ b/com/example/api/model/Datum.java @@ -0,0 +1,89 @@ +package com.example.api.model; + + + +public class Datum{ + + private static final String FIELD_COVER_URL = "coverUrl"; + private static final String FIELD_PHOTO_NUMS = "photoNums"; + private static final String FIELD_ID = "id"; + private static final String FIELD_TITLE = "title"; + private static final String FIELD_COLLECTION = "collection"; + private static final String FIELD_CREATED_TYPE = "createdType"; + + + private String mCoverUrl; + private int mPhotoNum; + private int mId; + private String mTitle; + private boolean mCollection; + private int mCreatedType; + + + public Datum(){ + + } + + public void setCoverUrl(String coverUrl) { + mCoverUrl = coverUrl; + } + + public String getCoverUrl() { + return mCoverUrl; + } + + public void setPhotoNum(int photoNum) { + mPhotoNum = photoNum; + } + + public int getPhotoNum() { + return mPhotoNum; + } + + public void setId(int id) { + mId = id; + } + + public int getId() { + return mId; + } + + public void setTitle(String title) { + mTitle = title; + } + + public String getTitle() { + return mTitle; + } + + public void setCollection(boolean collection) { + mCollection = collection; + } + + public boolean isCollection() { + return mCollection; + } + + public void setCreatedType(int createdType) { + mCreatedType = createdType; + } + + public int getCreatedType() { + return mCreatedType; + } + + @Override + public boolean equals(Object obj){ + if(obj instanceof Datum){ + return ((Datum) obj).getId().equals(mId); + } + return false; + } + + @Override + public int hashCode(){ + return mId.hashCode(); + } + + +} \ No newline at end of file diff --git a/com/example/api/model/Gen.java b/com/example/api/model/Gen.java new file mode 100644 index 0000000..73ef5dc --- /dev/null +++ b/com/example/api/model/Gen.java @@ -0,0 +1,37 @@ +package com.example.api.model; + +import java.util.List; + + +public class Gen{ + + private static final String FIELD_DATA = "data"; + private static final String FIELD_RES_HEADER = "resHeader"; + + + private List mData; + private ResHeader mResHeader; + + + public Gen(){ + + } + + public void setData(List data) { + mData = data; + } + + public List getData() { + return mData; + } + + public void setResHeader(ResHeader resHeader) { + mResHeader = resHeader; + } + + public ResHeader getResHeader() { + return mResHeader; + } + + +} \ No newline at end of file diff --git a/com/example/api/model/ResHeader.java b/com/example/api/model/ResHeader.java new file mode 100644 index 0000000..3ff0f26 --- /dev/null +++ b/com/example/api/model/ResHeader.java @@ -0,0 +1,36 @@ +package com.example.api.model; + + + +public class ResHeader{ + + private static final String FIELD_MESSAGE = "message"; + private static final String FIELD_CODE = "code"; + + + private String mMessage; + private int mCode; + + + public ResHeader(){ + + } + + public void setMessage(String message) { + mMessage = message; + } + + public String getMessage() { + return mMessage; + } + + public void setCode(int code) { + mCode = code; + } + + public int getCode() { + return mCode; + } + + +} \ No newline at end of file diff --git a/com/example/api/model2/Datum.java b/com/example/api/model2/Datum.java new file mode 100644 index 0000000..6e22b36 --- /dev/null +++ b/com/example/api/model2/Datum.java @@ -0,0 +1,89 @@ +package com.example.api.model2; + + + +public class Datum{ + + private static final String FIELD_COVER_URL = "coverUrl"; + private static final String FIELD_PHOTO_NUMS = "photoNums"; + private static final String FIELD_ID = "id"; + private static final String FIELD_TITLE = "title"; + private static final String FIELD_COLLECTION = "collection"; + private static final String FIELD_CREATED_TYPE = "createdType"; + + + private String mCoverUrl; + private int mPhotoNum; + private int mId; + private String mTitle; + private boolean mCollection; + private int mCreatedType; + + + public Datum(){ + + } + + public void setCoverUrl(String coverUrl) { + mCoverUrl = coverUrl; + } + + public String getCoverUrl() { + return mCoverUrl; + } + + public void setPhotoNum(int photoNum) { + mPhotoNum = photoNum; + } + + public int getPhotoNum() { + return mPhotoNum; + } + + public void setId(int id) { + mId = id; + } + + public int getId() { + return mId; + } + + public void setTitle(String title) { + mTitle = title; + } + + public String getTitle() { + return mTitle; + } + + public void setCollection(boolean collection) { + mCollection = collection; + } + + public boolean isCollection() { + return mCollection; + } + + public void setCreatedType(int createdType) { + mCreatedType = createdType; + } + + public int getCreatedType() { + return mCreatedType; + } + + @Override + public boolean equals(Object obj){ + if(obj instanceof Datum){ + return ((Datum) obj).getId().equals(mId); + } + return false; + } + + @Override + public int hashCode(){ + return mId.hashCode(); + } + + +} \ No newline at end of file diff --git a/com/example/api/model2/Pojo3.java b/com/example/api/model2/Pojo3.java new file mode 100644 index 0000000..0c88bdd --- /dev/null +++ b/com/example/api/model2/Pojo3.java @@ -0,0 +1,37 @@ +package com.example.api.model2; + +import java.util.List; + + +public class Pojo3{ + + private static final String FIELD_DATA = "data"; + private static final String FIELD_RES_HEADER = "resHeader"; + + + private List mData; + private ResHeader mResHeader; + + + public Pojo3(){ + + } + + public void setData(List data) { + mData = data; + } + + public List getData() { + return mData; + } + + public void setResHeader(ResHeader resHeader) { + mResHeader = resHeader; + } + + public ResHeader getResHeader() { + return mResHeader; + } + + +} \ No newline at end of file diff --git a/com/example/api/model2/ResHeader.java b/com/example/api/model2/ResHeader.java new file mode 100644 index 0000000..f32e757 --- /dev/null +++ b/com/example/api/model2/ResHeader.java @@ -0,0 +1,36 @@ +package com.example.api.model2; + + + +public class ResHeader{ + + private static final String FIELD_MESSAGE = "message"; + private static final String FIELD_CODE = "code"; + + + private String mMessage; + private int mCode; + + + public ResHeader(){ + + } + + public void setMessage(String message) { + mMessage = message; + } + + public String getMessage() { + return mMessage; + } + + public void setCode(int code) { + mCode = code; + } + + public int getCode() { + return mCode; + } + + +} \ No newline at end of file diff --git a/json/1.json b/json/1.json new file mode 100644 index 0000000..7f063c8 --- /dev/null +++ b/json/1.json @@ -0,0 +1 @@ +{"resHeader":{"code":"0","message":"业务处理成功"},"data":[{"id":2515,"title":"我的收藏","coverUrl":null,"photoNums":0,"collection":true,"createdType":2}]} \ No newline at end of file diff --git a/json/2.json b/json/2.json new file mode 100644 index 0000000..a645f5d --- /dev/null +++ b/json/2.json @@ -0,0 +1 @@ +{"resHeader":{"code":"0","message":"业务处理成功"},"data":[{"id":2109,"title":"weibo","coverUrl":"http://igpicturetest.boe.com//igpicture-test/136831/37eb0e6ce00e477587b476bcacb9b7c1.jpg","photoNums":4,"collection":false,"createdType":1}]} \ No newline at end of file diff --git a/json/3.json b/json/3.json new file mode 100644 index 0000000..cbf2aa8 --- /dev/null +++ b/json/3.json @@ -0,0 +1 @@ +{"resHeader":{"code":"0","message":"业务处理成功"},"data":{"albumManageTime":{"startTime":"2020-06-09 16:37:17","endTime":"2020-06-09 16:37:17"},"cover":"http://igpicturetest.boe.com//igpicture-test/136831/37eb0e6ce00e477587b476bcacb9b7c1.jpg","albumPhotoGroupList":{"albumGroupList":[{"date":"20200609","dateTime":1591691837000,"medias":[{"id":2000027467,"url":"http://igpicturetest.boe.com//igpicture-test/136831/c25950e132704eedbeccf534a90a4e88.jpg","thumbUrl":"https://igpicturetest.boe.com//igpicture-test/136831/c25950e132704eedbeccf534a90a4e88.jpg?x-oss-process=image/auto-orient,1/resize,m_fill,w_208,h_208,limit_0","type":1,"duration":0,"localCreated":1591691837000,"localMark":"/storage/emulated/0/sina/weibo/storage/photoalbum_save/weibo/img-cda7efe86cd9e32e0752ff7ecc63aeec.jpg;168","collected":null,"albumId":31917,"volume":null,"width":null,"height":null},{"id":2000027468,"url":"http://igpicturetest.boe.com//igpicture-test/136831/37eb0e6ce00e477587b476bcacb9b7c1.jpg","thumbUrl":"https://igpicturetest.boe.com//igpicture-test/136831/37eb0e6ce00e477587b476bcacb9b7c1.jpg?x-oss-process=image/auto-orient,1/resize,m_fill,w_208,h_208,limit_0","type":1,"duration":0,"localCreated":1591691844000,"localMark":"/storage/emulated/0/sina/weibo/storage/photoalbum_save/weibo/img-a38b309e7240a388db995b0a5ea03d64.jpg;294","collected":null,"albumId":31923,"volume":null,"width":null,"height":null},{"id":2000027470,"url":"http://igpicturetest.boe.com//igpicture-test/136831/9819a5ab908f4103abb565f2681defbe.jpg","thumbUrl":"https://igpicturetest.boe.com//igpicture-test/136831/9819a5ab908f4103abb565f2681defbe.jpg?x-oss-process=image/auto-orient,1/resize,m_fill,w_208,h_208,limit_0","type":1,"duration":0,"localCreated":1591691841000,"localMark":"/storage/emulated/0/sina/weibo/storage/photoalbum_save/weibo/img-0a93c3f323f213fb7381f3db950a2080.jpg;352","collected":null,"albumId":31929,"volume":null,"width":null,"height":null},{"id":2000027473,"url":"http://igpicturetest.boe.com//igpicture-test/136831/660cbb5eda744f7e877b06a6607982a6.jpg","thumbUrl":"https://igpicturetest.boe.com//igpicture-test/136831/660cbb5eda744f7e877b06a6607982a6.jpg?x-oss-process=image/auto-orient,1/resize,m_fill,w_208,h_208,limit_0","type":1,"duration":0,"localCreated":1591691830000,"localMark":"/storage/emulated/0/sina/weibo/storage/photoalbum_save/weibo/img-b7293953448558a1a0885ab4a824bfe7.jpg;212","collected":null,"albumId":31921,"volume":null,"width":null,"height":null}]}],"appendList":[]}}} \ No newline at end of file