diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 000000000..f0d9515f5
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,83 @@
+name: Bug Report/报告 bug
+description: "Create a report to help us improve, please read FAQ first./帮助我们更好地改进项目,但请先阅读常见问题与提问前必看,不要提已有的重复问题!"
+title: "[Bug] "
+labels: [kind/bug]
+body:
+- type: markdown
+ attributes:
+ value: "如果你已经知道问题所在、怎么解决,请直接 提交 Pull Request 为社区做贡献,非常感谢。\n开发者也是人,也需要工作、休息、恋爱、陪伴家人、走亲会友等,也有心情不好和身体病痛,\n往往没有额外的时间精力顾及一些小问题,请理解和支持,开源要大家参与贡献才会更美好~\n少数个人的热情终有被耗尽的一天,只有大家共同建设和繁荣社区,才能让开源可持续发展! "
+
+- type: input
+ attributes:
+ label: APIJSON Version/APIJSON 版本号
+ placeholder: |
+ e.g./例如 5.4.0 ,如果不是最新版请用最新版,复现问题再来,原则上不更新旧版,而是只维护一个最新版
+
+ validations:
+ required: true
+
+- type: input
+ attributes:
+ label: Database Type & Version/数据库类型及版本号
+ placeholder: |
+ e.g./例如 MySQL 5.7.34
+
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Environment/环境信息
+ description: |
+ e.g./例如:
+ - **JDK/基础库**: 1.8.0_17
+ - **OS/系统**: MacOS Monterey 12.6 (21G115) M1
+ value: |
+ - JDK/基础库:
+ - OS/系统:
+ render: markdown
+
+ validations:
+ required: true
+
+- type: input
+ attributes:
+ label: APIAuto Screenshots/APIAuto 请求与结果完整截屏
+ description: "Upload by copy and paste image file or url./复制图片文件或 URL 再粘贴到输入框(用 APIAuto 能静态检查出很多问题,甚至还有修复建议,不用浪费你我的时间)\n https://github.com/TommyLemon/APIAuto "
+ value:
+
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Current Behavior/问题描述
+ description: "A concise description of what you're experiencing. Must contains screenshots./\n\n**提 bug 请发请求和响应的【完整截屏】,没图的自行解决!\n开发者有限的时间和精力主要放在【维护项目源码和文档】上!\n【描述不详细】 或 【文档/常见问题 已有答案】 的问题可能会被忽略!!\n【态度 不文明/不友善】的可能会被拉黑,问题也可能不予解答!!!**\n\n请求参数 JSON 中表名、字段名、关键词及对应的值都是大小写敏感、逗号敏感、分号敏感、空格敏感、换行敏感,\n大部分情况都不允许空格和换行,表名以大写字母开头,不要想当然,请严格按照 设计规范 来调用 API \n https://github.com/Tencent/APIJSON/issues/181 "
+ render: markdown
+
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Expected Behavior/期望结果
+ description: A concise description of what you expected to happen./具体描述你期望返回什么样的结果或者达到什么样的效果?
+ render: markdown
+
+ validations:
+ required: false
+
+
+- type: textarea
+ attributes:
+ label: Any additional comments?/其它补充说明?
+ description: |
+ e.g. some background/context of how you ran into this bug./例如:一些背景或上下文信息,包括复现步骤、相关日志等
+ render: markdown
+
+ validations:
+ required: false
+
+- type: markdown
+ attributes:
+ value: "Please follow the rules to fulfil all required inputs. You can add screenshots by comment after submit this issue./\n请按要求填写所有必填项,未填完将提交不了!\n如果随意填写敷衍了事,将直接关闭 issue,问题不会得到解答!\n可以提交后再通过回复评论来补充上传截屏图片(复制粘贴文件)。\n如果是网页 bug 等与你无关的原因导致提交不了,可以改为填问卷:\n https://wj.qq.com/s2/10971431/2a09 "
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 000000000..3ba13e0ce
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1 @@
+blank_issues_enabled: false
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 000000000..6f14d47b3
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,17 @@
+name: Feature Request/期望新增功能
+description: Request a new feature/期望新增什么样的功能或特性,或者做哪些方面的改进?
+title: "[Feature] "
+labels: [kind/feature]
+body:
+- type: textarea
+ attributes:
+ label: Description
+ description: |
+ Please describe what this feature does./具体描述下是什么样的功能或特性,以及你为什么想要它,用在什么场景,碰到了什么痛点,有什么解决思路,尝试过哪些,效果怎样?
+
+ validations:
+ required: true
+
+- type: markdown
+ attributes:
+ value: 推荐去建议收集箱提问,也方便 统一检索和管理、投票决定优先级、更新处理进度 等: https://github.com/Tencent/APIJSON/issues/37
diff --git a/.github/ISSUE_TEMPLATE/other_issues.yml b/.github/ISSUE_TEMPLATE/other_issues.yml
new file mode 100644
index 000000000..9f9a6d0ea
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/other_issues.yml
@@ -0,0 +1,16 @@
+name: Other Issues/其它反馈
+description: For questions, suggestions, improvements and others./问题(非 bug)、建议(非新增功能) 或 其它
+title: "[xxx] "
+body:
+- type: textarea
+ attributes:
+ label: Description
+ description: |
+ Please describe the issue./请具体描述,包括是什么、为什么、如何做
+
+ validations:
+ required: true
+
+- type: markdown
+ attributes:
+ value: "Bug 反馈请使用正确的模板,用错模板将直接关闭 issue,不予解答:\n https://github.com/Tencent/APIJSON/issues/new?assignees=&labels=kind%2Fbug&template=bug_report.yml&title=%5BBug%5D+ \n有建议请去建议收集箱提问,也方便 统一检索和管理、投票决定优先级、更新处理进度 等:\n https://github.com/Tencent/APIJSON/issues/37 "
diff --git a/.gitignore b/.gitignore
index 802e6845e..a06bbd0a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,38 @@
.DS_Store
-APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/bin
-APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/bin
+.gradle
+yarn.lock
+*.project
+
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**
+!**/src/test/**
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+
+### VS Code ###
+.vscode/
+APIJSONORM/bin
+*.DS_Store
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/.classpath b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/.classpath
deleted file mode 100644
index 51769745b..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/.project b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/.project
deleted file mode 100644
index e41c0ebd6..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- APIJSONLibrary
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/.travis.yml b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/.travis.yml
deleted file mode 100644
index b53dcff1e..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/.travis.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-language: android
-sudo: false
-jdk:
- - oraclejdk7
-android:
- components:
- - build-tools-23.0.2
- - android-21
- - extra-android-m2repository
- - extra-android-support
-before_install:
- - export CHROME_BIN=chromium-browser
- - export JAVA_HOME=/usr/lib/jvm/java-7-oraclejdk7-amd64
- - export ANDROID_HOME=/usr/local/android-sdk
- - echo yes | android put sdk --all --no-ui --force
- - export DISPLAY=:99.0
- - sh -e /etc/init.d/apijson start
-before_script:
- - . $HOME/.nvm/nvm.sh
- - nvm install 4
- - nvm use 4
- - npm install
- - echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
- - emulator -avd test -no-audio -no-window &
- - android-wait-for-emulator
- - adb shell input keyevent 82 &
-script: "make test"
-after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/AndroidManifest.xml b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/AndroidManifest.xml
deleted file mode 100644
index 93e2d0fcb..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/AndroidManifest.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/gen/zuo/biao/apijson/client/BuildConfig.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/gen/zuo/biao/apijson/client/BuildConfig.java
deleted file mode 100644
index c345af65a..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/gen/zuo/biao/apijson/client/BuildConfig.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/** Automatically generated file. DO NOT MODIFY */
-package zuo.biao.apijson.client;
-
-public final class BuildConfig {
- public final static boolean DEBUG = true;
-}
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/ic_launcher-web.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/ic_launcher-web.png
deleted file mode 100644
index a18cbb48c..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/ic_launcher-web.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/libs/fastjson-1.2.24.jar b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/libs/fastjson-1.2.24.jar
deleted file mode 100644
index 4a6652fb5..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/libs/fastjson-1.2.24.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/proguard-project.txt b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/proguard-project.txt
deleted file mode 100644
index f2fe1559a..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/project.properties b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/project.properties
deleted file mode 100644
index 93c8c3c08..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/project.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-21
-android.library=true
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/APIJSONRequest.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/APIJSONRequest.java
deleted file mode 100644
index a00fc0416..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/APIJSONRequest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**请求方法对应的JSON结构
- * @author Lemon
- */
-@Target({ElementType.METHOD, ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface APIJSONRequest {
-
- /**
- * @return 允许的请求方法
- */
- RequestMethod[] method() default {};
-
-
- /**@see {@link RequestMethod#POST_GET}
- * @return 该请求方法允许的结构
- */
- String POST_GET() default "";
-
- /**@see {@link RequestMethod#POST_HEAD}
- * @return 该请求方法允许的结构
- */
- String POST_HEAD() default "";
-
- /**@see {@link RequestMethod#POST}
- * @return 该请求方法允许的结构
- */
- String POST() default "";
-
- /**@see {@link RequestMethod#PUT}
- * @return 该请求方法允许的结构
- */
- String PUT() default "";
-
- /**@see {@link RequestMethod#DELETE}
- * @return 该请求方法允许的结构
- */
- String DELETE() default "";
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/FunctionList.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/FunctionList.java
deleted file mode 100644
index 6dc2d3407..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/FunctionList.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**可远程调用的函数列表
- * @author Lemon
- */
-public interface FunctionList {
-
- //判断是否为空 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- /**判断collection是否为空
- * @param collection
- * @return
- */
- public boolean isEmpty(Collection collection);
- /**判断map是否为空
- * @param
- * @param
- * @param map
- * @return
- */
- public boolean isEmpty(Map map);
- //判断是否为空 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //判断是否为包含 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- /**判断collection是否包含object
- * @param collection
- * @param object
- * @return
- */
- public boolean isContain(Collection collection, T object);
- /**判断map是否包含key
- * @param
- * @param
- * @param map
- * @param key
- * @return
- */
- public boolean isContainKey(Map map, K key);
- /**判断map是否包含value
- * @param
- * @param
- * @param map
- * @param value
- * @return
- */
- public boolean isContainValue(Map map, V value);
- //判断是否为包含 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //获取集合长度 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- /**获取数量
- * @param
- * @param array
- * @return
- */
- public int count(T[] array);
- /**获取数量
- * @param
- * @param collection List, Vector, Set等都是Collection的子类
- * @return
- */
- public int count(Collection collection);
- /**获取数量
- * @param
- * @param
- * @param map
- * @return
- */
- public int count(Map map);
- //获取集合长度 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //获取集合长度 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- /**获取
- * @param
- * @param array
- * @return
- */
- public T get(T[] array, int position);
- /**获取
- * @param
- * @param collection List, Vector, Set等都是Collection的子类
- * @return
- */
- public T get(Collection collection, int position);
- /**获取
- * @param
- * @param
- * @param map null ? null
- * @param key null ? null : map.get(key);
- * @return
- */
- public V get(Map map, K key);
- //获取集合长度 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- //获取非基本类型对应基本类型的非空值 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- /**获取非空值
- * @param value
- * @return
- */
- public boolean value(Boolean value);
- /**获取非空值
- * @param value
- * @return
- */
- public int value(Integer value);
- /**获取非空值
- * @param value
- * @return
- */
- public long value(Long value);
- /**获取非空值
- * @param value
- * @return
- */
- public float value(Float value);
- /**获取非空值
- * @param value
- * @return
- */
- public double value(Double value);
- //获取非基本类型对应基本类型的非空值 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSON.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSON.java
deleted file mode 100644
index 61757d906..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSON.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import java.util.List;
-
-import android.util.Log;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.parser.Feature;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-
-/**阿里FastJSON封装类 防止解析时异常
- * @author Lemon
- */
-public class JSON {
- private static final String TAG = "JSON";
-
- /**判断json格式是否正确
- * @param s
- * @return
- */
- public static boolean isJsonCorrect(String s) {
-// Log.i(TAG, "isJsonCorrect <<<< " + s + " >>>>>>>");
- if (s == null
- // || s.equals("[]")
- // || s.equals("{}")
- || s.equals("")
- || s.equals("[null]")
- || s.equals("{null}")
- || s.equals("null")) {
- return false;
- }
- return true;
- }
-
- /**获取有效的json
- * @param s
- * @return
- */
- public static String getCorrectJson(String s) {
- return getCorrectJson(s, false);
- }
- /**获取有效的json
- * @param s
- * @param isArray
- * @return
- */
- public static String getCorrectJson(String s, boolean isArray) {
- s = StringUtil.getTrimedString(s);
- // if (isArray) {
- // if (s.startsWith("\"")) {
- // s = s.substring(1);
- // }
- // if (s.endsWith("\"")) {
- // s = s.substring(0, s.length() - 1);
- // }
- // }
- return s;//isJsonCorrect(s) ? s : null;
- }
-
- /**json转JSONObject
- * @param json
- * @return
- */
- public static JSONObject parseObject(Object obj) {
- return parseObject(toJSONString(obj));
- }
- /**json转JSONObject
- * @param json
- * @return
- */
- public static JSONObject parseObject(String json) {
- int features = com.alibaba.fastjson.JSON.DEFAULT_PARSER_FEATURE;
- features |= Feature.OrderedField.getMask();
- return parseObject(json, features);
- }
- /**json转JSONObject
- * @param json
- * @param features
- * @return
- */
- public static JSONObject parseObject(String json, int features) {
- try {
- return com.alibaba.fastjson.JSON.parseObject(getCorrectJson(json), JSONObject.class, features);
- } catch (Exception e) {
- Log.i(TAG, "parseObject catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**JSONObject转实体类
- * @param object
- * @param clazz
- * @return
- */
- public static T parseObject(JSONObject object, Class clazz) {
- return parseObject(toJSONString(object), clazz);
- }
- /**json转实体类
- * @param json
- * @param clazz
- * @return
- */
- public static T parseObject(String json, Class clazz) {
- try {
- int features = com.alibaba.fastjson.JSON.DEFAULT_PARSER_FEATURE;
- features |= Feature.OrderedField.getMask();
- return com.alibaba.fastjson.JSON.parseObject(getCorrectJson(json), clazz, features);
- } catch (Exception e) {
- Log.i(TAG, "parseObject catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**json转JSONArray
- * @param json
- * @return
- */
- public static JSONArray parseArray(String json) {
- try {
- return com.alibaba.fastjson.JSON.parseArray(getCorrectJson(json, true));
- } catch (Exception e) {
- Log.i(TAG, "parseArray catch \n" + e.getMessage());
- }
- return null;
- }
- /**JSONArray转实体类列表
- * @param array
- * @param clazz
- * @return
- */
- public static List parseArray(JSONArray array, Class clazz) {
- return parseArray(toJSONString(array), clazz);
- }
- /**json转实体类列表
- * @param json
- * @param clazz
- * @return
- */
- public static List parseArray(String json, Class clazz) {
- try {
- return com.alibaba.fastjson.JSON.parseArray(getCorrectJson(json, true), clazz);
- } catch (Exception e) {
- Log.i(TAG, "parseArray catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**实体类转json
- * @param obj
- * @return
- */
- public static String toJSONString(Object obj) {
- if (obj instanceof String) {
- return (String) obj;
- }
- try {
- return com.alibaba.fastjson.JSON.toJSONString(obj);
- } catch (Exception e) {
- Log.e(TAG, "toJSONString catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**实体类转json
- * @param obj
- * @param features
- * @return
- */
- public static String toJSONString(Object obj, SerializerFeature... features) {
- if (obj instanceof String) {
- return (String) obj;
- }
- try {
- return com.alibaba.fastjson.JSON.toJSONString(obj, features);
- } catch (Exception e) {
- Log.e(TAG, "parseArray catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**格式化,显示更好看
- * @param json
- * @return
- */
- public static String format(String json) {
- return format(parseObject(json));
- }
- /**格式化,显示更好看
- * @param object
- * @return
- */
- public static String format(JSONObject object) {
- return toJSONString(object, SerializerFeature.PrettyFormat);
- }
-
- /**判断是否为JSONObject
- * @param obj instanceof String ? parseObject
- * @return
- */
- public static boolean isJSONObject(Object obj) {
- if (obj instanceof JSONObject) {
- return true;
- }
- if (obj instanceof String) {
- try {
- JSONObject json = parseObject((String) obj);
- return json != null && json.isEmpty() == false;
- } catch (Exception e) {
- Log.e(TAG, "isJSONObject catch \n" + e.getMessage());
- }
- }
-
- return false;
- }
- /**判断是否为JSONArray
- * @param obj instanceof String ? parseArray
- * @return
- */
- public static boolean isJSONArray(Object obj) {
- if (obj instanceof JSONArray) {
- return true;
- }
- if (obj instanceof String) {
- try {
- JSONArray json = parseArray((String) obj);
- return json != null && json.isEmpty() == false;
- } catch (Exception e) {
- Log.e(TAG, "isJSONArray catch \n" + e.getMessage());
- }
- }
-
- return false;
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSONObject.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSONObject.java
deleted file mode 100644
index 9b109a3f0..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSONObject.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import static zuo.biao.apijson.StringUtil.UTF_8;
-import static zuo.biao.apijson.StringUtil.bigAlphaPattern;
-import static zuo.biao.apijson.StringUtil.namePattern;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.Set;
-
-
-/**use this class instead of com.alibaba.fastjson.JSONObject, not encode in default cases
- * @author Lemon
- */
-public class JSONObject extends com.alibaba.fastjson.JSONObject {
- private static final long serialVersionUID = 8907029699680768212L;
-
- /**ordered
- */
- public JSONObject() {
- super(true);
- }
- /**transfer Object to JSONObject
- * encode = false;
- * @param object
- * @see {@link #JSONObject(Object, boolean)}
- */
- public JSONObject(Object object) {
- this(object, false);
- }
- /**transfer Object to JSONObject
- * @param object
- * @param encode
- * @see {@link #JSONObject(String, boolean)}
- */
- public JSONObject(Object object, boolean encode) {
- this(toJSONString(object), encode);
- }
- /**parse JSONObject with JSON String
- * encode = false;
- * @param json
- * @see {@link #JSONObject(String, boolean)}
- */
- public JSONObject(String json) {
- this(json, false);
- }
- /**parse JSONObject with JSON String
- * @param json
- * @param encode
- * @see {@link #JSONObject(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject(String json, boolean encode) {
- this(parseObject(json), encode);
- }
- /**transfer com.alibaba.fastjson.JSONObject to JSONObject
- * encode = false;
- * @param object
- * @see {@link #JSONObject(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject(com.alibaba.fastjson.JSONObject object) {
- this(object, false);
- }
- /**transfer com.alibaba.fastjson.JSONObject to JSONObject
- * @param object
- * @param encode
- * @see {@link #add(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject(com.alibaba.fastjson.JSONObject object, boolean encode) {
- this();
- add(object, encode);
- }
-
-
-
-
- /**put key-value in object into this
- * encode = false;
- * @param object
- * @return {@link #add(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject add(com.alibaba.fastjson.JSONObject object) {
- return add(object, false);
- }
- /**put key-value in object into this
- * @param object
- * @param encode
- * @return this
- */
- public JSONObject add(com.alibaba.fastjson.JSONObject object, boolean encode) {
- Set set = object == null ? null : object.keySet();
- if (set != null) {
- for (String key : set) {
- put(key, object.get(key), encode);
- }
- }
- return this;
- }
-
-
-
- /**
- * @param key if decode && key instanceof String, key = URLDecoder.decode((String) key, UTF_8)
- * @param decode if decode && value instanceof String, value = URLDecoder.decode((String) value, UTF_8)
- * @return
- */
- public Object get(Object key, boolean decode) {
- if (decode) {
- if (key instanceof String) {
- if (((String) key).endsWith("+") || ((String) key).endsWith("-")) {
- try {//多层encode导致内部Comment[]传到服务端decode后最终变为Comment%5B%5D
- key = URLDecoder.decode((String) key, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- return null;
- }
- }
- }
- Object value = super.get(key);
- if (value instanceof String) {
- try {
- value = URLDecoder.decode((String) value, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
- return value;
- }
- return super.get(key);
- }
-
- /**
- * encode = false
- * @param value
- * @return {@link #put(String, boolean)}
- */
- public Object put(Object value) {
- return put(value, false);
- }
- /**
- * key = value.getClass().getSimpleName()
- * @param value
- * @param encode
- * @return {@link #put(String, Object, boolean)}
- */
- public Object put(Object value, boolean encode) {
- return put(null, value, encode);
- }
- /**
- * @param key if StringUtil.isNotEmpty(key, true) == false,
- *
key = value == null ? null : value.getClass().getSimpleName();
- *
>> if decode && key instanceof String, key = URLDecoder.decode((String) key, UTF_8)
- * @param value URLEncoder.encode((String) value, UTF_8);
- * @param encode if value instanceof String, value = URLEncoder.encode((String) value, UTF_8);
- * @return
- */
- public Object put(String key, Object value, boolean encode) {
- if (StringUtil.isNotEmpty(key, true) == false) {
- key = value == null ? null : value.getClass().getSimpleName();
- }
- if (encode) {
- if (key.endsWith("+") || key.endsWith("-")) {
- try {//多层encode导致内部Comment[]传到服务端decode后最终变为Comment%5B%5D
- key = URLEncoder.encode(key, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
- if (value instanceof String) {//只在value instanceof String时encode key?{@link #get(Object, boolean)}内做不到
- try {
- value = URLEncoder.encode((String) value, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
- }
- return super.put(key, value);
- }
-
-
-
- //judge <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- public static final String KEY_ARRAY = "[]";
-
- /**判断是否为Array的key
- * @param key
- * @return
- */
- public static boolean isArrayKey(String key) {
- return key != null && key.endsWith(KEY_ARRAY);
- }
- /**判断是否为对应Table的key
- * @param key
- * @return
- */
- public static boolean isTableKey(String key) {
- return isWord(key) && bigAlphaPattern.matcher(key.substring(0, 1)).matches();
- }
- /**判断是否为词,只能包含字母,数字或下划线
- * @param key
- * @return
- */
- public static boolean isWord(String key) {
- return StringUtil.isNotEmpty(key, false) && namePattern.matcher(key).matches();
- }
- //judge >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- public static final String KEY_COLUMNS = "@columns";//@key关键字都放这个类
-
- /**set columns need to be returned
- * @param columns "column0,column1,column2..."
- * @return
- */
- public JSONObject setColumns(String columns) {
- put(KEY_COLUMNS, columns);
- return this;
- }
- public String getColumns() {
- return getString(KEY_COLUMNS);
- }
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSONRequest.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSONRequest.java
deleted file mode 100644
index 75db0dc3c..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSONRequest.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-/**encapsulator for request JSONObject, encode in default cases
- * @author Lemon
- * @see #toArray
- * @use JSONRequest request = new JSONRequest(...);
- *
request.put(...);//not a must
- *
request.toArray(...);//not a must
- */
-public class JSONRequest extends JSONObject {
-
- private static final long serialVersionUID = -2223023180338466812L;
-
- public JSONRequest() {
- super();
- }
- /**
- * encode = true
- * @param object
- * @see {@link #JSONRequest(String, Object)}
- */
- public JSONRequest(Object object) {
- this(null, object);
- }
- /**
- * encode = true
- * @param name
- * @param object
- * @see {@link #JSONRequest(String, Object, boolean)}
- */
- public JSONRequest(String name, Object object) {
- this(name, object, true);
- }
- /**
- * @param object
- * @param encode
- * @see {@link #JSONRequest(String, Object, boolean)}
- */
- public JSONRequest(Object object, boolean encode) {
- this(null, object, encode);
- }
- /**
- * @param name
- * @param object
- * @param encode
- * @see {@link #put(String, Object, boolean)}
- */
- public JSONRequest(String name, Object object, boolean encode) {
- this();
- put(name, object, encode);
- }
-
-
-
-
-
-
- public static final String KEY_TAG = "tag";
-
- public JSONObject setTag(String tag) {
- put(KEY_TAG, tag);
- return this;
- }
- public String getTag() {
- return getString(KEY_TAG);
- }
-
-
- //array object <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final String KEY_COUNT = "count";
- public static final String KEY_PAGE = "page";
-
- public JSONRequest setCount(int count) {
- put(KEY_COUNT, count);
- return this;
- }
- public int getCount() {
- return getIntValue(KEY_COUNT);
- }
-
- public JSONRequest setPage(int page) {
- put(KEY_PAGE, page);
- return this;
- }
- public int getPage() {
- return getIntValue(KEY_PAGE);
- }
- //array object >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
- /**
- * @param value
- * @param parts path = parts[0] + "/" + parts[1] + "/" + parts[2] + ...
- * @return
- */
- public Object putPath(String key, String... parts) {
- String path = "";
- if (parts != null) {
- for (int i = 0; i < parts.length; i++) {
- path += (i > 0 ? "/" : "") + parts[i];
- }
- }
- return put(key, path);
- }
-
- // 导致JSONObject add >> get = null
- // /**
- // * decode = true
- // * @param key
- // * return {@link #get(Object, boolean)}
- // */
- // @Override
- // public Object get(Object key) {
- // return get(key, true);
- // }
-
- /**
- * encode = true
- * @param value
- * @return {@link #put(String, boolean)}
- */
- public Object put(Object value) {
- return put(value, true);
- }
- /**
- * encode = true
- * @param key
- * @param value
- * return {@link #put(String, Object, boolean)}
- */
- @Override
- public Object put(String key, Object value) {
- return put(key, value, true);
- }
-
-
- /**create a parent JSONObject named KEY_ARRAY
- * encode = true;
- * @param count
- * @param page
- * @return {@link #toArray(int, int, boolean)}
- */
- public JSONRequest toArray(int count, int page) {
- return toArray(count, page, true);
- }
- /**create a parent JSONObject named KEY_ARRAY
- * encode = true;
- * @param count
- * @param page
- * @return {@link #toArray(int, int, String, boolean)}
- */
- public JSONRequest toArray(int count, int page, boolean encode) {
- return toArray(count, page, null, encode);
- }
- /**create a parent JSONObject named name+KEY_ARRAY
- * encode = true;
- * @param count
- * @param page
- * @param name
- * @return {@link #toArray(int, int, String, boolean)}
- */
- public JSONRequest toArray(int count, int page, String name) {
- return toArray(count, page, name, true);
- }
- /**create a parent JSONObject named name+KEY_ARRAY
- * @param count
- * @param page
- * @param name
- * @param encode
- * @return {name+KEY_ARRAY : this}
- */
- public JSONRequest toArray(int count, int page, String name, boolean encode) {
- return new JSONRequest(StringUtil.getString(name) + KEY_ARRAY, this.setCount(count).setPage(page), encode);
- }
-
-
- /**设置搜索
- * @param key
- * @param value
- * @see {@link #putSearch(String, String, int)}
- */
- public void putSearch(String key, String value) {
- putSearch(key, value, SEARCH_TYPE_CONTAIN_FULL);
- }
- /**设置搜索
- * encode = true
- * @param key
- * @param value
- * @param type
- * @see {@link #putSearch(String, String, int, boolean)}
- */
- public void putSearch(String key, String value, int type) {
- putSearch(key, value, type, true);
- }
- /**设置搜索
- * @param key
- * @param value
- * @param type
- * @param encode
- */
- public void putSearch(String key, String value, int type, boolean encode) {
- if (key == null) {
- key = "";
- }
- if (key.endsWith("$") == false) {
- key += "$";
- }
- put(key, getSearch(value, type), encode);
- }
-
- public static final int SEARCH_TYPE_CONTAIN_FULL = 0;
- public static final int SEARCH_TYPE_CONTAIN_ORDER = 1;
- public static final int SEARCH_TYPE_CONTAIN_SINGLE = 2;
- public static final int SEARCH_TYPE_CONTAIN_ANY = 3;
- public static final int SEARCH_TYPE_START = 4;
- public static final int SEARCH_TYPE_END = 5;
- public static final int SEARCH_TYPE_START_SINGLE = 6;
- public static final int SEARCH_TYPE_END_SINGLE = 7;
- public static final int SEARCH_TYPE_PART_MATCH = 8;
- /**
- * SQL中NOT LIKE就行??
- */
- public static final int SEARCH_TYPE_NO_CONTAIN = 9;
- /**
- * SQL中NOT LIKE就行??
- */
- public static final int SEARCH_TYPE_NO_PART_MATCH = 10;
- /**获取搜索值
- * @param key
- * @return
- */
- public static String getSearch(String key) {
- return getSearch(key, SEARCH_TYPE_CONTAIN_FULL);
- }
- /**获取搜索值
- * @param key
- * @param type
- * @return
- */
- public static String getSearch(String key, int type) {
- return getSearch(key, type, true);
- }
- /**获取搜索值
- * @param key
- * @param type
- * @param ignoreCase
- * @return
- */
- public static String getSearch(String key, int type, boolean ignoreCase) {
- if (key == null) {
- return null;
- }
- switch (type) {
- case SEARCH_TYPE_CONTAIN_SINGLE:
- return "_" + key + "_";
- case SEARCH_TYPE_CONTAIN_ORDER:
- char[] cs = key.toCharArray();
- if (cs == null) {
- return null;
- }
- String s = "%";
- for (int i = 0; i < cs.length; i++) {
- s += cs[i] + "%";
- }
- return s;
- case SEARCH_TYPE_START:
- return key + "%";
- case SEARCH_TYPE_END:
- return "%" + key;
- case SEARCH_TYPE_START_SINGLE:
- return key + "_";
- case SEARCH_TYPE_END_SINGLE:
- return "_" + key;
- case SEARCH_TYPE_NO_CONTAIN:
- return "[^" + key + "]";
- case SEARCH_TYPE_NO_PART_MATCH:
- cs = key.toCharArray();
- if (cs == null) {
- return null;
- }
- s = "";
- for (int i = 0; i < cs.length; i++) {
- s += getSearch("" + cs[i], SEARCH_TYPE_NO_CONTAIN, ignoreCase);
- }
- return s;
- default:
- return "%" + key + "%";
- }
- }
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSONResponse.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSONResponse.java
deleted file mode 100644
index 0dca2a3f3..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/JSONResponse.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import static zuo.biao.apijson.StringUtil.bigAlphaPattern;
-
-import java.util.List;
-import java.util.Set;
-
-import android.annotation.SuppressLint;
-import android.util.Log;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-/**parser for response JSON String
- * @author Lemon
- * @see #getList
- * @see #toArray
- * @use JSONResponse response = new JSONResponse(...);
- *
JSONArray array = JSONResponse.toArray(response.getJSONObject(KEY_ARRAY));//not a must
- *
User user = JSONResponse.getObject(response, User.class);//not a must
- *
List list = JSONResponse.getList(response.getJSONObject("Comment[]"), Comment.class);//not a must
- */
-@SuppressWarnings("serial")
-public class JSONResponse extends zuo.biao.apijson.JSONObject {
- private static final String TAG = "JSONResponse";
-
- public JSONResponse() {
- super();
- }
- public JSONResponse(String json) {
- this(parseObject(json));
- }
- public JSONResponse(JSONObject object) {
- super(format(object));
- }
-
- //状态信息,非GET请求获得的信息<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final int STATUS_SUCCEED = 200;
-
-
- public static final String KEY_ID = "id";
- public static final String KEY_STATUS = "status";
- public static final String KEY_COUNT = "count";
- public static final String KEY_MESSAGE = "message";
-
- /**获取id
- * @return
- */
- public long getId() {
- return getLongValue(KEY_ID);
- }
- /**获取状态
- * @return
- */
- public int getStatus() {
- return getIntValue(KEY_STATUS);
- }
- /**获取数量
- * @return
- */
- public int getCount() {
- return getIntValue(KEY_COUNT);
- }
- /**获取信息
- * @return
- */
- public String getMessage() {
- return getString(KEY_MESSAGE);
- }
-
- /**是否成功
- * @return
- */
- public boolean isSucceed() {
- return isSucceed(getStatus());
- }
- /**是否成功
- * @param status
- * @return
- */
- public static boolean isSucceed(int status) {
- return status == STATUS_SUCCEED;
- }
- /**是否成功
- * @param response
- * @return
- */
- public static boolean isSucceed(JSONResponse response) {
- return response != null && response.isSucceed();
- }
-
- /**校验服务端是否存在table
- * @return
- */
- public boolean isExist() {
- return isExist(getCount());
- }
- /**校验服务端是否存在table
- * @param count
- * @return
- */
- public static boolean isExist(int count) {
- return count > 0;
- }
- /**校验服务端是否存在table
- * @param response
- * @return
- */
- public static boolean isExist(JSONResponse response) {
- return response != null && response.isExist();
- }
-
- /**获取内部的JSONResponse
- * @param key
- * @return
- */
- public JSONResponse getJSONResponse(String key) {
- return getObject(key, JSONResponse.class);
- }
- //状态信息,非GET请求获得的信息>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
- /**
- * key = clazz.getSimpleName()
- * @param clazz
- * @return
- */
- public T getObject(Class clazz) {
- return getObject(clazz == null ? "" : clazz.getSimpleName(), clazz);
- }
- /**
- * @param key
- * @param clazz
- * @return
- */
- public T getObject(String key, Class clazz) {
- return getObject(this, key, clazz);
- }
- /**
- * @param object
- * @param key
- * @param clazz
- * @return
- */
- public static T getObject(JSONObject object, String key, Class clazz) {
- return toObject(object == null ? null : object.getJSONObject(key), clazz);
- }
-
- /**
- * @param clazz
- * @return
- */
- public T toObject(Class clazz) {
- return toObject(this, clazz);
- }
- /**
- * @param object
- * @param clazz
- * @return
- */
- public static T toObject(JSONObject object, Class clazz) {
- return JSON.parseObject(JSON.toJSONString(object), clazz);
- }
-
-
-
-
- /**
- * key = KEY_ARRAY
- * @param clazz
- * @return
- */
- public List getList(Class clazz) {
- return getList(KEY_ARRAY, clazz);
- }
- /**
- * arrayObject = this
- * @param key
- * @param clazz
- * @return
- */
- public List getList(String key, Class clazz) {
- return getList(this, key, clazz);
- }
-
- /**
- * key = KEY_ARRAY
- * @param object
- * @param clazz
- * @return
- */
- public static List getList(JSONObject object, Class clazz) {
- return getList(object, KEY_ARRAY, clazz);
- }
- /**
- * @param object
- * @param key
- * @param clazz
- * @return
- */
- public static List getList(JSONObject object, String key, Class clazz) {
- Object obj = object == null ? null : object.get(replaceArray(key));
- if (obj == null) {
- return null;
- }
- return obj instanceof JSONArray ? JSON.parseArray((JSONArray) obj, clazz) : toList((JSONObject) obj, clazz);
- }
- /**
- * @param clazz
- * @return
- */
- public List toList(Class clazz) {
- return toList(this, clazz);
- }
- /**
- * @param arrayObject
- * @param clazz
- * @return
- */
- public static List toList(JSONObject arrayObject, Class clazz) {
- return clazz == null ? null : JSON.parseArray(JSON.toJSONString(
- toArray(arrayObject, clazz.getSimpleName())), clazz);
- }
-
- /**
- * key = KEY_ARRAY
- * @param className
- * @return
- */
- public JSONArray getArray(String className) {
- return getArray(KEY_ARRAY, className);
- }
- /**
- * @param key
- * @param className
- * @return
- */
- public JSONArray getArray(String key, String className) {
- return getArray(this, key, className);
- }
- /**
- * @param object
- * @param key
- * @param className
- * @return
- */
- public static JSONArray getArray(JSONObject object, String className) {
- return getArray(object, KEY_ARRAY, className);
- }
- /**
- * key = KEY_ARRAY
- * @param object
- * @param className
- * @return
- */
- public static JSONArray getArray(JSONObject object, String key, String className) {
- Object obj = object == null ? null : object.get(replaceArray(key));
- if (obj == null) {
- return null;
- }
- return obj instanceof JSONArray ? (JSONArray) obj : toArray((JSONObject) obj, className);
- }
-
- /**
- * @param className
- * @return
- */
- public JSONArray toArray(String className) {
- return toArray(this, className);
- }
- /**
- * @param arrayObject
- * @param className
- * @return
- */
- public static JSONArray toArray(JSONObject arrayObject, String className) {
- Set set = arrayObject == null ? null : arrayObject.keySet();
- if (set == null || set.isEmpty()) {
- return null;
- }
-
- // [{...},{...},...]
- String parentString = StringUtil.getTrimedString(JSON.toJSONString(arrayObject));
- if (parentString.isEmpty()) {
- return null;
- }
- if (parentString.startsWith("[")) {
- if (parentString.endsWith("]") == false) {
- parentString += "]";
- }
- return JSON.parseArray(parentString);
- }
-
- //{"0":{Table:{...}}, "1":{Table:{...}}...}
-
- className = StringUtil.getTrimedString(className);
- boolean isContainer = true;
-
- JSONArray array = new JSONArray(set.size());
- JSONObject value;
- boolean isFirst = true;
- int index;
- for (String key : set) {//0, 1, 2,...
- value = StringUtil.isNumer(key) == false ? null : arrayObject.getJSONObject(key);// Table:{}
- if (value != null) {
- try {
- index = Integer.valueOf(0 + key);
- if (isFirst && className.isEmpty() == false && value.containsKey(className)) {// 判断是否需要提取table
- isContainer = false;
- }
- array.set(index, isContainer ? value : value.getJSONObject(className));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- isFirst = false;
- }
- return array;
- }
-
-
-
- // /**将Table[]:{0:{Table:{}}, 1:{Table:{}}...} 转化为 tableList:[{}, {}]
- // * @return
- // */
- // public JSONObject format() {
- // return format(this);
- // }
- /**将Table[]:{0:{Table:{}}, 1:{Table:{}}...} 转化为 tableList:[{}, {}]
- * @param target
- * @param response
- * @return
- */
- public static JSONObject format(final JSONObject response) {
- Log.i(TAG, "format response = \n" + JSON.toJSONString(response));
- if (response == null || response.isEmpty()) {
- Log.i(TAG, "format response == null || response.isEmpty() >> return response;");
- return response;
- }
- JSONObject transferredObject = new JSONObject(true);
-
- Set set = response.keySet();
- if (set != null) {
- Object value;
- String arrayKey;
- for (String key : set) {
- value = response.get(key);
- if (value instanceof JSONArray) {//转化JSONArray内部的APIJSON Array
- transferredObject.put(key, format((JSONArray) value));
- } else if (value instanceof JSONObject) {//APIJSON Array转为常规JSONArray
- if (isArrayKey(key)) {//APIJSON Array转为常规JSONArray
- arrayKey = key.substring(0, key.indexOf(KEY_ARRAY));
- transferredObject.put(getArrayKey(arrayKey), format(toArray((JSONObject) value, arrayKey)));
- } else {//常规JSONObject,往下一级提取
- transferredObject.put(key, format((JSONObject) value));
- }
- } else {//其它Object,直接填充
- transferredObject.put(key, value);
- }
- }
- }
-
- Log.i(TAG, "format return transferredObject = " + JSON.toJSONString(transferredObject));
- return transferredObject;
- }
- /**
- * @param responseArray
- * @return
- */
- public static JSONArray format(final JSONArray responseArray) {
- Log.i(TAG, "format responseArray = \n" + JSON.toJSONString(responseArray));
- if (responseArray == null || responseArray.isEmpty()) {
- Log.i(TAG, "format responseArray == null || responseArray.isEmpty() >> return response;");
- return responseArray;
- }
- JSONArray transferredArray = new JSONArray();
-
- Object value;
- for (int i = 0; i < responseArray.size(); i++) {
- value = responseArray.get(i);
- if (value instanceof JSONArray) {//转化JSONArray内部的APIJSON Array
- transferredArray.add(format((JSONArray) value));
- } else if (value instanceof JSONObject) {//JSONObject,往下一级提取
- transferredArray.add(format((JSONObject) value));
- } else {//其它Object,直接填充
- transferredArray.add(responseArray.get(i));
- }
- }
-
- Log.i(TAG, "format return transferredArray = " + JSON.toJSONString(transferredArray));
- return transferredArray;
- }
-
- /**替换key+KEY_ARRAY为keyList
- * @param key
- * @return isArrayKey(key) ? getArrayKey(...) : key
- */
- public static String replaceArray(String key) {
- if (isArrayKey(key)) {
- return getArrayKey(key.substring(0, key.indexOf(KEY_ARRAY)));
- }
- return key;
- }
- /**获取列表变量名
- * @param key => StringUtil.getNoBlankString(key)
- * @return empty ? "list" : key + "List" 且首字母小写
- */
- @SuppressLint("DefaultLocale")
- public static String getArrayKey(String key) {
- key = StringUtil.getNoBlankString(key);
- if (key.isEmpty()) {
- return "list";
- }
-
- String first = key.substring(0, 1);
- if (bigAlphaPattern.matcher(first).matches()) {
- key = first.toLowerCase() + key.substring(1, key.length());
- }
- return key + "List";
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/RequestMethod.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/RequestMethod.java
deleted file mode 100644
index 4ff717bbf..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/RequestMethod.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-/**请求方法,对应org.springframework.web.bind.annotation.RequestMethod,多出一个POST_GET方法
- * @author Lemon
- */
-public enum RequestMethod {
-
- /**
- * 常规获取数据方式
- */
- GET,
-
- /**
- * 通过POST来HEAD数据,不显示请求内容和返回结果,一般用于对安全要求比较高的请求
- */
- POST_HEAD,
-
- /**
- * 通过POST来GET数据,不显示请求内容和返回结果,一般用于对安全要求比较高的请求
- */
- POST_GET,
-
- /**
- * 新增(或者说插入)数据
- */
- POST,
-
- /**
- * 修改数据,只修改传入字段对应的值
- */
- PUT,
-
- /**
- * 删除数据
- */
- DELETE,
-
- /**
- * 检查,默认是非空检查,返回数据总数
- */
- HEAD
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/StringUtil.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/StringUtil.java
deleted file mode 100644
index b86924040..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/StringUtil.java
+++ /dev/null
@@ -1,664 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import java.io.File;
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**通用字符串(String)相关类,为null时返回""
- * @author Lemon
- * @use StringUtil.
- */
-public class StringUtil {
-
- public StringUtil() {
- }
-
- public static final String UTF_8 = "utf-8";
-
- public static final String EMPTY = "无";
- public static final String UNKNOWN = "未知";
- public static final String UNLIMITED = "不限";
-
- public static final String I = "我";
- public static final String YOU = "你";
- public static final String HE = "他";
- public static final String SHE = "她";
- public static final String IT = "它";
-
- public static final String MALE = "男";
- public static final String FEMALE = "女";
-
- public static final String TODO = "未完成";
- public static final String DONE = "已完成";
-
- public static final String FAIL = "失败";
- public static final String SUCCESS = "成功";
-
- public static final String SUNDAY = "日";
- public static final String MONDAY = "一";
- public static final String TUESDAY = "二";
- public static final String WEDNESDAY = "三";
- public static final String THURSDAY = "四";
- public static final String FRIDAY = "五";
- public static final String SATURDAY = "六";
-
- public static final String YUAN = "元";
-
-
- private static String currentString = "";
- /**获取刚传入处理后的string
- * @must 上个影响currentString的方法 和 这个方法都应该在同一线程中,否则返回值可能不对
- * @return
- */
- public static String getCurrentString() {
- return currentString == null ? "" : currentString;
- }
-
- //获取string,为null时返回"" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取string,为null则返回""
- * @param object
- * @return
- */
- public static String getString(Object object) {
- return object == null ? "" : getString(String.valueOf(object));
- }
- /**获取string,为null则返回""
- * @param cs
- * @return
- */
- public static String getString(CharSequence cs) {
- return cs == null ? "" : getString(cs.toString());
- }
- /**获取string,为null则返回""
- * @param s
- * @return
- */
- public static String getString(String s) {
- return s == null ? "" : s;
- }
- /**获取string,为null则返回""
- * @param array
- * @return
- */
- public static String getString(String[] array) {
- return getString(array, null);
- }
- /**获取string,为null则返回""
- * @param array
- * @param split
- * @return
- */
- public static String getString(String[] array, String split) {
- String s = "";
- if (array != null) {
- if (split == null) {
- split = ",";
- }
- for (int i = 0; i < array.length; i++) {
- s += ((i > 0 ? split : "") + array[i]);
- }
- }
- return getString(s);
- }
-
- //获取string,为null时返回"" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //获取去掉前后空格后的string<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取去掉前后空格后的string,为null则返回""
- * @param object
- * @return
- */
- public static String getTrimedString(Object object) {
- return getTrimedString(getString(object));
- }
- /**获取去掉前后空格后的string,为null则返回""
- * @param cs
- * @return
- */
- public static String getTrimedString(CharSequence cs) {
- return getTrimedString(getString(cs));
- }
- /**获取去掉前后空格后的string,为null则返回""
- * @param s
- * @return
- */
- public static String getTrimedString(String s) {
- return getString(s).trim();
- }
-
- //获取去掉前后空格后的string>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //获取去掉所有空格后的string <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取去掉所有空格后的string,为null则返回""
- * @param object
- * @return
- */
- public static String getNoBlankString(Object object) {
- return getNoBlankString(getString(object));
- }
- /**获取去掉所有空格后的string,为null则返回""
- * @param cs
- * @return
- */
- public static String getNoBlankString(CharSequence cs) {
- return getNoBlankString(getString(cs));
- }
- /**获取去掉所有空格后的string,为null则返回""
- * @param s
- * @return
- */
- public static String getNoBlankString(String s) {
- return getString(s).replaceAll("\\s", "");
- }
-
- //获取去掉所有空格后的string >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //获取string的长度<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取string的长度,为null则返回0
- * @param object
- * @param trim
- * @return
- */
- public static int getLength(Object object, boolean trim) {
- return getLength(getString(object), trim);
- }
- /**获取string的长度,为null则返回0
- * @param cs
- * @param trim
- * @return
- */
- public static int getLength(CharSequence cs, boolean trim) {
- return getLength(getString(cs), trim);
- }
- /**获取string的长度,为null则返回0
- * @param s
- * @param trim
- * @return
- */
- public static int getLength(String s, boolean trim) {
- s = trim ? getTrimedString(s) : s;
- return getString(s).length();
- }
-
- //获取string的长度>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //判断字符是否非空 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**判断字符是否非空
- * @param object
- * @param trim
- * @return
- */
- public static boolean isNotEmpty(Object object, boolean trim) {
- return isNotEmpty(getString(object), trim);
- }
- /**判断字符是否非空
- * @param cs
- * @param trim
- * @return
- */
- public static boolean isNotEmpty(CharSequence cs, boolean trim) {
- return isNotEmpty(getString(cs), trim);
- }
- /**判断字符是否非空
- * @param s
- * @param trim
- * @return
- */
- public static boolean isNotEmpty(String s, boolean trim) {
- // Log.i(TAG, "getTrimedString s = " + s);
- if (s == null) {
- return false;
- }
- if (trim) {
- s = s.trim();
- }
- if (s.length() <= 0) {
- return false;
- }
-
- currentString = s;
-
- return true;
- }
-
- //判断字符是否非空 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //判断字符类型 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final Pattern alphaPattern;
- public static final Pattern bigAlphaPattern;
- public static final Pattern namePattern;
- public static final Pattern smallAlphaPattern;
- static {
- alphaPattern = Pattern.compile("[a-zA-Z]");
- bigAlphaPattern = Pattern.compile("[A-Z]");
- namePattern = Pattern.compile("^[0-9a-zA-Z_]+$");//已用55个中英字符测试通过
- smallAlphaPattern = Pattern.compile("[a-z]");
- }
-
- //判断手机格式是否正确
- public static boolean isPhone(String phone) {
- if (isNotEmpty(phone, true) == false) {
- return false;
- }
-
- Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0-2,5-9])|(17[0-9]))\\d{8}$");
-
- currentString = phone;
-
- return p.matcher(phone).matches();
- }
- //判断email格式是否正确
- public static boolean isEmail(String email) {
- if (isNotEmpty(email, true) == false) {
- return false;
- }
-
- String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
- Pattern p = Pattern.compile(str);
-
- currentString = email;
-
- return p.matcher(email).matches();
- }
-
- /**判断是否全是数字
- * @param s
- * @return
- */
- public static boolean isNumer(String s) {
- if (isNotEmpty(s, true) == false) {
- return false;
- }
-
- Pattern pattern = Pattern.compile("[0-9]");
- Matcher matcher;
- for (int i = 0; i < s.length(); i++) {
- matcher = pattern.matcher(s.substring(i, i+1));
- if(! matcher.matches()){
- return false;
- }
- }
-
- currentString = s;
-
- return true;
- }
- /**判断是否全是字母
- * @param s
- * @return
- */
- public static boolean isAlpha(String s) {
- if (s == null) {
- System.out.println("isNumberOrAlpha inputed == null >> return false;");
- return false;
- }
- Pattern pAlpha = Pattern.compile("[a-zA-Z]");
- Matcher mAlpha;
- for (int i = 0; i < s.length(); i++) {
- mAlpha = pAlpha.matcher(s.substring(i, i+1));
- if(! mAlpha.matches()){
- return false;
- }
- }
-
- currentString = s;
- return true;
- }
- /**判断是否全是数字或字母
- * @param s
- * @return
- */
- public static boolean isNumberOrAlpha(String s) {
- return isNumer(s) || isAlpha(s);
- }
-
- /**判断字符类型是否是身份证号
- * @param idCard
- * @return
- */
- public static boolean isIDCard(String idCard) {
- if (isNumberOrAlpha(idCard) == false) {
- return false;
- }
- idCard = getString(idCard);
- if (idCard.length() == 15) {
- System.out.println("isIDCard idCard.length() == 15 old IDCard");
- currentString = idCard;
- return true;
- }
- if (idCard.length() == 18) {
- currentString = idCard;
- return true;
- }
-
- return false;
- }
-
- public static final String HTTP = "http";
- public static final String URL_PREFIX = "http://";
- public static final String URL_PREFIXs = "https://";
- public static final String URL_STAFFIX = URL_PREFIX;
- public static final String URL_STAFFIXs = URL_PREFIXs;
- /**判断字符类型是否是网址
- * @param url
- * @return
- */
- public static boolean isUrl(String url) {
- if (isNotEmpty(url, true) == false) {
- return false;
- } else if (! url.startsWith(URL_PREFIX) && ! url.startsWith(URL_PREFIXs)) {
- return false;
- }
-
- currentString = url;
- return true;
- }
-
- public static final String FILE_PATH_PREFIX = "file://";
- /**判断文件路径是否存在
- * @param path
- * @return
- */
- public static boolean isFilePathExist(String path) {
- return StringUtil.isFilePath(path) && new File(path).exists();
- }
-
- public static final String SEPARATOR = "/";
- /**判断是否为路径
- * @param path
- * @return
- */
- public static boolean isPath(String path) {
- return StringUtil.isNotEmpty(path, true) && path.contains(SEPARATOR)
- && path.contains(SEPARATOR + SEPARATOR) == false && path.endsWith(SEPARATOR) == false;
- }
-
- /**分割路径
- * @param path
- * @return
- */
- public static String[] splitPath(String path) {
- return isPath(path) ? split(path, SEPARATOR) : new String[] {path};
- }
- /**将s分割成String[]
- * @param s
- * @return
- */
- public static String[] split(String s) {
- return split(s, null);
- }
- /**将s用split分割成String[]
- * @param s
- * @param split
- * @return
- */
- public static String[] split(String s, String split) {
- s = getString(s);
- if (s.isEmpty()) {
- return null;
- }
- if (isNotEmpty(split, false) == false) {
- split = ",";
- }
- while (s.startsWith(split)) {
- s = s.substring(split.length());
- }
- while (s.endsWith(split)) {
- s = s.substring(0, s.length() - split.length());
- }
- return s.contains(split) ? s.split(split) : new String[]{s};
- }
-
-
- /**判断字符类型是否是路径
- * @param path
- * @return
- */
- public static boolean isFilePath(String path) {
- if (isNotEmpty(path, true) == false) {
- return false;
- }
-
- if (! path.contains(".") || path.endsWith(".")) {
- return false;
- }
-
- currentString = path;
-
- return true;
- }
-
- //判断字符类型 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //提取特殊字符<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**去掉string内所有非数字类型字符
- * @param object
- * @return
- */
- public static String getNumber(Object object) {
- return getNumber(getString(object));
- }
- /**去掉string内所有非数字类型字符
- * @param cs
- * @return
- */
- public static String getNumber(CharSequence cs) {
- return getNumber(getString(cs));
- }
- /**去掉string内所有非数字类型字符
- * @param s
- * @return
- */
- public static String getNumber(String s) {
- return getNumber(s, false);
- }
- /**去掉string内所有非数字类型字符
- * @param s
- * @param onlyStart 中间有非数字时只获取前面的数字
- * @return
- */
- public static String getNumber(String s, boolean onlyStart) {
- if (isNotEmpty(s, true) == false) {
- return "";
- }
-
- String numberString = "";
- String single;
- for (int i = 0; i < s.length(); i++) {
- single = s.substring(i, i + 1);
- if (isNumer(single)) {
- numberString += single;
- } else {
- if (onlyStart) {
- return numberString;
- }
- }
- }
-
- return numberString;
- }
-
- //提取特殊字符>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //校正(自动补全等)字符串<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取网址,自动补全
- * @param url
- * @return
- */
- public static String getCorrectUrl(String url) {
- System.out.println("getCorrectUrl : \n" + url);
- if (isNotEmpty(url, true) == false) {
- return "";
- }
-
- // if (! url.endsWith("/") && ! url.endsWith(".html")) {
- // url = url + "/";
- // }
-
- if (isUrl(url) == false) {
- return URL_PREFIX + url;
- }
- return url;
- }
-
- /**获取去掉所有 空格 、"-" 、"+86" 后的phone
- * @param phone
- * @return
- */
- public static String getCorrectPhone(String phone) {
- if (isNotEmpty(phone, true) == false) {
- return "";
- }
-
- phone = getNoBlankString(phone);
- phone = phone.replaceAll("-", "");
- if (phone.startsWith("+86")) {
- phone = phone.substring(3);
- }
- return phone;
- }
-
-
- /**获取邮箱,自动补全
- * @param email
- * @return
- */
- public static String getCorrectEmail(String email) {
- if (isNotEmpty(email, true) == false) {
- return "";
- }
-
- email = getNoBlankString(email);
- if (isEmail(email) == false && ! email.endsWith(".com")) {
- email += ".com";
- }
-
- return email;
- }
-
-
- public static final int PRICE_FORMAT_DEFAULT = 0;
- public static final int PRICE_FORMAT_PREFIX = 1;
- public static final int PRICE_FORMAT_SUFFIX = 2;
- public static final int PRICE_FORMAT_PREFIX_WITH_BLANK = 3;
- public static final int PRICE_FORMAT_SUFFIX_WITH_BLANK = 4;
- public static final String[] PRICE_FORMATS = {
- "", "¥", "元", "¥ ", " 元"
- };
-
- /**获取价格,保留两位小数
- * @param price
- * @return
- */
- public static String getPrice(String price) {
- return getPrice(price, PRICE_FORMAT_DEFAULT);
- }
- /**获取价格,保留两位小数
- * @param price
- * @param formatType 添加单位(元)
- * @return
- */
- public static String getPrice(String price, int formatType) {
- if (isNotEmpty(price, true) == false) {
- return getPrice(0, formatType);
- }
-
- //单独写到getCorrectPrice? <<<<<<<<<<<<<<<<<<<<<<
- String correctPrice = "";
- String s;
- for (int i = 0; i < price.length(); i++) {
- s = price.substring(i, i + 1);
- if (".".equals(s) || isNumer(s)) {
- correctPrice += s;
- }
- }
- //单独写到getCorrectPrice? >>>>>>>>>>>>>>>>>>>>>>
-
- System.out.println("getPrice <<<<<<<<<<<<<<<<<< correctPrice = " + correctPrice);
- if (correctPrice.contains(".")) {
- // if (correctPrice.startsWith(".")) {
- // correctPrice = 0 + correctPrice;
- // }
- if (correctPrice.endsWith(".")) {
- correctPrice = correctPrice.replaceAll(".", "");
- }
- }
-
- System.out.println("getPrice correctPrice = " + correctPrice + " >>>>>>>>>>>>>>>>");
- return isNotEmpty(correctPrice, true) ? getPrice(new BigDecimal(0 + correctPrice), formatType) : getPrice(0, formatType);
- }
- /**获取价格,保留两位小数
- * @param price
- * @return
- */
- public static String getPrice(BigDecimal price) {
- return getPrice(price, PRICE_FORMAT_DEFAULT);
- }
- /**获取价格,保留两位小数
- * @param price
- * @return
- */
- public static String getPrice(double price) {
- return getPrice(price, PRICE_FORMAT_DEFAULT);
- }
- /**获取价格,保留两位小数
- * @param price
- * @param formatType 添加单位(元)
- * @return
- */
- public static String getPrice(BigDecimal price, int formatType) {
- return getPrice(price == null ? 0 : price.doubleValue(), formatType);
- }
- /**获取价格,保留两位小数
- * @param price
- * @param formatType 添加单位(元)
- * @return
- */
- public static String getPrice(double price, int formatType) {
- String s = new DecimalFormat("#########0.00").format(price);
- switch (formatType) {
- case PRICE_FORMAT_PREFIX:
- return PRICE_FORMATS[PRICE_FORMAT_PREFIX] + s;
- case PRICE_FORMAT_SUFFIX:
- return s + PRICE_FORMATS[PRICE_FORMAT_SUFFIX];
- case PRICE_FORMAT_PREFIX_WITH_BLANK:
- return PRICE_FORMATS[PRICE_FORMAT_PREFIX_WITH_BLANK] + s;
- case PRICE_FORMAT_SUFFIX_WITH_BLANK:
- return s + PRICE_FORMATS[PRICE_FORMAT_SUFFIX_WITH_BLANK];
- default:
- return s;
- }
- }
-
- //校正(自动补全等)字符串>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/client/package-info.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/client/package-info.java
deleted file mode 100644
index 2d815a9dd..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/client/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * files for client projects
- */
-/**
- * @author Lemon
- *
- */
-package zuo.biao.apijson.client;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/package-info.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/package-info.java
deleted file mode 100644
index 707b9d11a..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONLibrary/src/zuo/biao/apijson/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * the same files for server and client projects
- */
-/**
- * @author Lemon
- *
- */
-package zuo.biao.apijson;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/.classpath b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/.classpath
deleted file mode 100644
index 51769745b..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/.project b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/.project
deleted file mode 100644
index 8b589f913..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- APIJSONTest
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/AndroidManifest.xml b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/AndroidManifest.xml
deleted file mode 100644
index 972be9a9f..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/AndroidManifest.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/APIJSONTest.apk b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/APIJSONTest.apk
deleted file mode 100644
index 6d0741214..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/APIJSONTest.apk and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/AndroidManifest.xml b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/AndroidManifest.xml
deleted file mode 100644
index 972be9a9f..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/AndroidManifest.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/R.txt b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/R.txt
deleted file mode 100644
index 22e0e815d..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/R.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-int dimen activity_horizontal_margin 0x7f040000
-int dimen activity_vertical_margin 0x7f040001
-int drawable ic_launcher 0x7f020000
-int id btnRequestRequest 0x7f070003
-int id btnSelectAccessError 0x7f07000c
-int id btnSelectAccessPermitted 0x7f07000d
-int id btnSelectArray 0x7f07000a
-int id btnSelectColumns 0x7f070008
-int id btnSelectComplex 0x7f07000b
-int id btnSelectDelete 0x7f070006
-int id btnSelectPost 0x7f070004
-int id btnSelectPut 0x7f070005
-int id btnSelectRely 0x7f070009
-int id btnSelectSingle 0x7f070007
-int id btnSelectUpdateLog 0x7f07000e
-int id etRequestUrl 0x7f070002
-int id pbRequest 0x7f070001
-int id tvRequestResult 0x7f070000
-int layout request_activity 0x7f030000
-int layout select_activity 0x7f030001
-int string access_error 0x7f05000c
-int string access_permitted 0x7f05000d
-int string apijson_info 0x7f050013
-int string apijson_slogan 0x7f050012
-int string app_name 0x7f050000
-int string app_version 0x7f050001
-int string array 0x7f05000a
-int string browser_can_only_receive_get_response 0x7f050010
-int string columns 0x7f050008
-int string complex 0x7f05000b
-int string delete 0x7f050004
-int string get 0x7f050006
-int string post 0x7f050003
-int string put 0x7f050005
-int string received_result 0x7f05000f
-int string rely 0x7f050009
-int string request 0x7f050002
-int string request_error 0x7f050011
-int string single 0x7f050007
-int string update_log 0x7f05000e
-int style AppBaseTheme 0x7f060000
-int style AppTheme 0x7f060001
-int style activity_page 0x7f060003
-int style match_match 0x7f060002
-int style match_wrap 0x7f060004
-int style select_json 0x7f060006
-int style select_name 0x7f060005
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes.dex b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes.dex
deleted file mode 100644
index 2a2da62b4..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes.dex and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/BuildConfig.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/BuildConfig.class
deleted file mode 100644
index 1fe50cef8..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/BuildConfig.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$1.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$1.class
deleted file mode 100644
index 619a364bf..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$1.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$2.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$2.class
deleted file mode 100644
index 8ea79a509..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$2.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$HttpHead.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$HttpHead.class
deleted file mode 100644
index 6325649bb..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$HttpHead.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$OnHttpResponseListener.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$OnHttpResponseListener.class
deleted file mode 100644
index bd965dc78..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager$OnHttpResponseListener.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager.class
deleted file mode 100644
index 1c598adfa..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/HttpManager.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$attr.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$attr.class
deleted file mode 100644
index 38706c8c4..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$attr.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$dimen.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$dimen.class
deleted file mode 100644
index e9d83630b..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$dimen.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$drawable.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$drawable.class
deleted file mode 100644
index 5645df461..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$drawable.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$id.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$id.class
deleted file mode 100644
index 83e1de05c..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$id.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$layout.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$layout.class
deleted file mode 100644
index 7d390e997..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$layout.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$string.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$string.class
deleted file mode 100644
index 9305924fd..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$string.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$style.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$style.class
deleted file mode 100644
index a3955f7f3..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R$style.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R.class
deleted file mode 100644
index 53fb0a302..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/R.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/RequestUtil.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/RequestUtil.class
deleted file mode 100644
index 86845d13c..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/RequestUtil.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/StringUtil.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/StringUtil.class
deleted file mode 100644
index 7684abfd6..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/StringUtil.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/application/DemoApplication.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/application/DemoApplication.class
deleted file mode 100644
index db0cbbbf9..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/application/DemoApplication.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/application/package-info.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/application/package-info.class
deleted file mode 100644
index 6832cb9cd..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/application/package-info.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/BaseModel.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/BaseModel.class
deleted file mode 100644
index ef804e051..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/BaseModel.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/Comment.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/Comment.class
deleted file mode 100644
index 6d7507fdc..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/Comment.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/Moment.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/Moment.class
deleted file mode 100644
index df695fa65..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/Moment.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/User.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/User.class
deleted file mode 100644
index 6c74781ae..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/User.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/Wallet.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/Wallet.class
deleted file mode 100644
index 957a6f531..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/Wallet.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/package-info.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/package-info.class
deleted file mode 100644
index beb36c9fc..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/model/package-info.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/package-info.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/package-info.class
deleted file mode 100644
index 2e6fcf054..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/package-info.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity$1.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity$1.class
deleted file mode 100644
index 653431329..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity$1.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity$2.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity$2.class
deleted file mode 100644
index 5b36603d3..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity$2.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity$3.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity$3.class
deleted file mode 100644
index 195f5480d..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity$3.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity.class
deleted file mode 100644
index dc8e8f1ac..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/RequestActivity.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/SelectActivity$1.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/SelectActivity$1.class
deleted file mode 100644
index 96c3f9e54..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/SelectActivity$1.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/SelectActivity.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/SelectActivity.class
deleted file mode 100644
index cc3aefc41..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/SelectActivity.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/package-info.class b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/package-info.class
deleted file mode 100644
index a9aecdc7a..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/classes/apijson/demo/ui/package-info.class and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/apijsonlibrary-09663776c8184766ccec0154e0464720.jar b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/apijsonlibrary-09663776c8184766ccec0154e0464720.jar
deleted file mode 100644
index 1351cc677..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/apijsonlibrary-09663776c8184766ccec0154e0464720.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/fastjson-1.2.24-62d096c23aa404c08fb811336d13cb41.jar b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/fastjson-1.2.24-62d096c23aa404c08fb811336d13cb41.jar
deleted file mode 100644
index 7fddbe23d..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/fastjson-1.2.24-62d096c23aa404c08fb811336d13cb41.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/okhttp-2.1.0-d45f1ac69f9e644b6dee481b9ca65625.jar b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/okhttp-2.1.0-d45f1ac69f9e644b6dee481b9ca65625.jar
deleted file mode 100644
index bde8bef82..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/okhttp-2.1.0-d45f1ac69f9e644b6dee481b9ca65625.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/okio-1.0.0-e1d4a61966bde00ab4c46131ad8f03b5.jar b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/okio-1.0.0-e1d4a61966bde00ab4c46131ad8f03b5.jar
deleted file mode 100644
index bde04fe7f..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/dexedLibs/okio-1.0.0-e1d4a61966bde00ab4c46131ad8f03b5.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/jarlist.cache b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/jarlist.cache
deleted file mode 100644
index 0565465f2..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/jarlist.cache
+++ /dev/null
@@ -1,3 +0,0 @@
-# cache for current jar dependency. DO NOT EDIT.
-# format is
-# Encoding is UTF-8
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-hdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 1dbefa9ac..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-mdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index c8e298642..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-xhdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index c0cad09cd..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-xxhdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 82b540708..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable/ic_launcher.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable/ic_launcher.png
deleted file mode 100644
index 1dbefa9ac..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/res/crunch/drawable/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/resources.ap_ b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/resources.ap_
deleted file mode 100644
index ea3643b28..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/bin/resources.ap_ and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/gen/apijson/demo/BuildConfig.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/gen/apijson/demo/BuildConfig.java
deleted file mode 100644
index f981f1513..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/gen/apijson/demo/BuildConfig.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/** Automatically generated file. DO NOT MODIFY */
-package apijson.demo;
-
-public final class BuildConfig {
- public final static boolean DEBUG = true;
-}
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/gen/apijson/demo/R.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/gen/apijson/demo/R.java
deleted file mode 100644
index 9ca96ff02..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/gen/apijson/demo/R.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package apijson.demo;
-
-public final class R {
- public static final class attr {
- }
- public static final class dimen {
- /** Default screen margins, per the Android Design guidelines.
- */
- public static final int activity_horizontal_margin=0x7f040000;
- public static final int activity_vertical_margin=0x7f040001;
- }
- public static final class drawable {
- public static final int ic_launcher=0x7f020000;
- }
- public static final class id {
- public static final int btnRequestRequest=0x7f070003;
- public static final int btnSelectAccessError=0x7f07000c;
- public static final int btnSelectAccessPermitted=0x7f07000d;
- public static final int btnSelectArray=0x7f07000a;
- public static final int btnSelectColumns=0x7f070008;
- public static final int btnSelectComplex=0x7f07000b;
- public static final int btnSelectDelete=0x7f070006;
- public static final int btnSelectPost=0x7f070004;
- public static final int btnSelectPut=0x7f070005;
- public static final int btnSelectRely=0x7f070009;
- public static final int btnSelectSingle=0x7f070007;
- public static final int btnSelectUpdateLog=0x7f07000e;
- public static final int etRequestUrl=0x7f070002;
- public static final int pbRequest=0x7f070001;
- public static final int tvRequestResult=0x7f070000;
- }
- public static final class layout {
- public static final int request_activity=0x7f030000;
- public static final int select_activity=0x7f030001;
- }
- public static final class string {
- public static final int access_error=0x7f05000c;
- public static final int access_permitted=0x7f05000d;
- public static final int apijson_info=0x7f050013;
- public static final int apijson_slogan=0x7f050012;
- public static final int app_name=0x7f050000;
- public static final int app_version=0x7f050001;
- public static final int array=0x7f05000a;
- public static final int browser_can_only_receive_get_response=0x7f050010;
- public static final int columns=0x7f050008;
- public static final int complex=0x7f05000b;
- public static final int delete=0x7f050004;
- public static final int get=0x7f050006;
- public static final int post=0x7f050003;
- public static final int put=0x7f050005;
- public static final int received_result=0x7f05000f;
- public static final int rely=0x7f050009;
- public static final int request=0x7f050002;
- public static final int request_error=0x7f050011;
- public static final int single=0x7f050007;
- public static final int update_log=0x7f05000e;
- }
- public static final class style {
- /**
- Base application theme, dependent on API level. This theme is replaced
- by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-
-
- Theme customizations available in newer API levels can go in
- res/values-vXX/styles.xml, while customizations related to
- backward-compatibility can go here.
-
- */
- public static final int AppBaseTheme=0x7f060000;
- /** Application theme.
- All customizations that are NOT specific to a particular API-level can go here.
- */
- public static final int AppTheme=0x7f060001;
- public static final int activity_page=0x7f060003;
- public static final int match_match=0x7f060002;
- public static final int match_wrap=0x7f060004;
- public static final int select_json=0x7f060006;
- public static final int select_name=0x7f060005;
- }
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/ic_launcher-web.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/ic_launcher-web.png
deleted file mode 100644
index a18cbb48c..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/ic_launcher-web.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/libs/okhttp-2.1.0.jar b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/libs/okhttp-2.1.0.jar
deleted file mode 100644
index 837defb9d..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/libs/okhttp-2.1.0.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/libs/okio-1.0.0.jar b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/libs/okio-1.0.0.jar
deleted file mode 100644
index 909cfa98d..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/libs/okio-1.0.0.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/proguard-project.txt b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/proguard-project.txt
deleted file mode 100644
index f2fe1559a..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/project.properties b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/project.properties
deleted file mode 100644
index ab2adb2c9..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/project.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-21
-android.library.reference.1=../APIJSONLibrary
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-hdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index cde69bccc..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-mdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-mdpi/ic_launcher.png
deleted file mode 100755
index c133a0cbd..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-xhdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100755
index bfa42f0e7..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-xxhdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100755
index 324e72cdd..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable/ic_launcher.png b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable/ic_launcher.png
deleted file mode 100644
index cde69bccc..000000000
Binary files a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/drawable/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/layout/request_activity.xml b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/layout/request_activity.xml
deleted file mode 100644
index 758c1acf7..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/layout/request_activity.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/layout/select_activity.xml b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/layout/select_activity.xml
deleted file mode 100644
index 32de20861..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/layout/select_activity.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values-en/strings.xml b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values-en/strings.xml
deleted file mode 100644
index c2259a8f1..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values-en/strings.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- Request
- POST
- DELETE
- PUT
- GET
- Single
- Columns
- Rely
- Array
- Complex
- Access Error
- Access Permitted
- Update Log
- received result!
- Browsers can only receive GET responses
- There may be something wrong,you can follow by the steps:\n\n1.Check your net connection\n\n2.Check the url whether it\'s an available ipv4 address\n\n3.Long click the [ %1$s ] button to open the request by web browser\n\n4.Check logs outputed on the target server\n\n5.Try again
- APIJSON, let interfaces go to hell!
- APIJSON is a JSON Transmission Structure Protocol…
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values/dimens.xml b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values/dimens.xml
deleted file mode 100644
index 55c1e5908..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values/dimens.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
- 16dp
- 16dp
-
-
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values/strings.xml b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values/strings.xml
deleted file mode 100644
index 573f5a3c4..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- APIJSONTest
- 2.0
- 请求
- 增
- 删
- 改
- 查
- 单个Object
- 指定字段
- 向上依赖
- Object数组
- 复杂结构
- 没有访问权限
- 允许使用权限
- 更新日志
- 已获得结果!
- 用浏览器只能获取GET结果
- 可能出现了一些问题,可以按照以下步骤解决:\n\n1.检查网络连接\n\n2.检查url是否为一个可用的IPV4地址\n\n3.长按[ %1$s ]按钮用浏览器发送请求\n\n4.查看目标服务器上的log\n\n5.再试一次
- APIJSON, let interfaces go to hell!
- APIJSON is a JSON Transmission Structure Protocol…
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values/styles.xml b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values/styles.xml
deleted file mode 100644
index 69e2137a1..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/res/values/styles.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/HttpManager.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/HttpManager.java
deleted file mode 100644
index 79bee91f3..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/HttpManager.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo;
-
-import static zuo.biao.apijson.StringUtil.UTF_8;
-
-import java.io.IOException;
-import java.net.CookieHandler;
-import java.net.URI;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import zuo.biao.apijson.StringUtil;
-import android.content.Context;
-import android.os.AsyncTask;
-import android.text.TextUtils;
-import android.util.Log;
-import apijson.demo.application.DemoApplication;
-
-import com.squareup.okhttp.MediaType;
-import com.squareup.okhttp.OkHttpClient;
-import com.squareup.okhttp.Request;
-import com.squareup.okhttp.RequestBody;
-import com.squareup.okhttp.Response;
-
-/**HTTP请求管理类
- * @author Lemon
- * @use HttpManager.getInstance().get(...)或HttpManager.getInstance().post(...) > 在回调方法onHttpRequestSuccess和onHttpRequestError处理HTTP请求结果
- * @must 解决getToken,getResponseCode,getResponseData中的TODO
- */
-public class HttpManager {
- private static final String TAG = "HttpManager";
-
- /**网络请求回调接口
- */
- public interface OnHttpResponseListener {
- /**
- * @param requestCode 请求码,自定义,在发起请求的类中可以用requestCode来区分各个请求
- * @param resultJson 服务器返回的Json串
- * @param e 异常
- */
- void onHttpResponse(int requestCode, String resultJson, Exception e);
- }
-
-
-
- private Context context;
- private static HttpManager instance;// 单例
- private HttpManager(Context context) {
- this.context = context;
-
- }
-
- public synchronized static HttpManager getInstance() {
- if (instance == null) {
- instance = new HttpManager(DemoApplication.getInstance());
- }
- return instance;
- }
-
-
-
- /**
- * 列表首页页码。有些服务器设置为1,即列表页码从1开始
- */
- public static final int PAGE_NUM_0 = 0;
-
- public static final String KEY_TOKEN = "token";
- public static final String KEY_COOKIE = "cookie";
-
-
- /**GET请求
- * @param paramList 请求参数列表,(可以一个键对应多个值)
- * @param url 接口url
- * @param requestCode
- * 请求码,类似onActivityResult中请求码,当同一activity中以实现接口方式发起多个网络请求时,请求结束后都会回调
- * {@link OnHttpResponseListener#onHttpResponse(int, String, Exception)}
- * 在发起请求的类中可以用requestCode来区分各个请求
- * @param listener
- */
- public void get(final String url_, final String request, final OnHttpResponseListener listener) {
- Log.d(TAG, "get url_ = " + url_ + "; request = " + request + " >>>");
- new AsyncTask() {
-
- String result;
- @Override
- protected Exception doInBackground(Void... params) {
- try {
- String url = StringUtil.getNoBlankString(url_)
- + URLEncoder.encode(StringUtil.getNoBlankString(request), UTF_8);
- StringBuffer sb = new StringBuffer();
- sb.append(url);
-
- OkHttpClient client = getHttpClient(url);
- if (client == null) {
- return new Exception(TAG + ".get AsyncTask.doInBackground client == null >> return;");
- }
-
- result = getResponseJson(client, new Request.Builder()
- .addHeader(KEY_TOKEN, getToken(url))
- .url(http://github.com/sb.toString()).build());
- } catch (Exception e) {
- Log.e(TAG, "get AsyncTask.doInBackground try { result = getResponseJson(..." +
- "} catch (Exception e) {\n" + e.getMessage());
- return e;
- }
-
- return null;
- }
-
- @Override
- protected void onPostExecute(Exception exception) {
- super.onPostExecute(exception);
- listener.onHttpResponse(0, result, exception);
- }
-
- }.execute();
-
- }
-
- public static final MediaType TYPE_JSON =MediaType.parse("application/json; charset=utf-8");
-
- /**POST请求
- * @param paramList 请求参数列表,(可以一个键对应多个值)
- * @param url 接口url
- * @param requestCode
- * 请求码,类似onActivityResult中请求码,当同一activity中以实现接口方式发起多个网络请求时,请求结束后都会回调
- * {@link OnHttpResponseListener#onHttpResponse(int, String, Exception)}
- * 在发起请求的类中可以用requestCode来区分各个请求
- * @param listener
- */
- public void post(final String url_, final String request, final OnHttpResponseListener listener) {
-
- new AsyncTask() {
-
- String result;
- @Override
- protected Exception doInBackground(Void... params) {
-
- try {
- String url = StringUtil.getNoBlankString(url_);
-
- OkHttpClient client = getHttpClient(url);
- if (client == null) {
- return new Exception(TAG + ".post AsyncTask.doInBackground client == null >> return;");
- }
-
- RequestBody requestBody = RequestBody.create(TYPE_JSON, request);
-
- result = getResponseJson(client, new Request.Builder()
- .addHeader(KEY_TOKEN, getToken(url)).url(http://github.com/StringUtil.getNoBlankString(url))
- .post(requestBody).build());
- } catch (Exception e) {
- Log.e(TAG, "post AsyncTask.doInBackground try { result = getResponseJson(..." +
- "} catch (Exception e) {\n" + e.getMessage());
- return e;
- }
-
- return null;
- }
-
- @Override
- protected void onPostExecute(Exception exception) {
- super.onPostExecute(exception);
- listener.onHttpResponse(0, result, exception);
- }
-
- }.execute();
- }
-
-
- //httpGet/httpPost 内调用方法 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**
- * @param url
- * @return
- */
- private OkHttpClient getHttpClient(String url) {
- Log.i(TAG, "getHttpClient url = " + url);
- if (StringUtil.isNotEmpty(url, true) == false) {
- Log.e(TAG, "getHttpClient StringUtil.isNotEmpty(url, true) == false >> return null;");
- return null;
- }
-
- OkHttpClient client = new OkHttpClient();
- client.setCookieHandler(new HttpHead());
- client.setConnectTimeout(15, TimeUnit.SECONDS);
- client.setWriteTimeout(10, TimeUnit.SECONDS);
- client.setReadTimeout(10, TimeUnit.SECONDS);
-
- return client;
- }
-
- /**
- * @param paramList
- * @must demo_***改为服务器设定值
- * @return
- */
- public String getToken(String tag) {
- return context.getSharedPreferences(KEY_TOKEN, Context.MODE_PRIVATE).getString(KEY_TOKEN + tag, "");
- }
- /**
- * @param tag
- * @param value
- */
- public void saveToken(String tag, String value) {
- context.getSharedPreferences(KEY_TOKEN, Context.MODE_PRIVATE)
- .edit()
- .remove(KEY_TOKEN + tag)
- .putString(KEY_TOKEN + tag, value)
- .commit();
- }
-
-
- /**
- * @return
- */
- public String getCookie() {
- return context.getSharedPreferences(KEY_COOKIE, Context.MODE_PRIVATE).getString(KEY_COOKIE, "");
- }
- /**
- * @param value
- */
- public void saveCookie(String value) {
- context.getSharedPreferences(KEY_COOKIE, Context.MODE_PRIVATE)
- .edit()
- .remove(KEY_COOKIE)
- .putString(KEY_COOKIE, value)
- .commit();
- }
-
-
- /**
- * @param client
- * @param request
- * @return
- * @throws Exception
- */
- private String getResponseJson(OkHttpClient client, Request request) throws Exception {
- if (client == null || request == null) {
- Log.e(TAG, "getResponseJson client == null || request == null >> return null;");
- return null;
- }
- Response response = client.newCall(request).execute();
- return response.isSuccessful() ? response.body().string() : null;
- }
-
- /**从object中获取key对应的值
- * *获取如果T是基本类型容易崩溃,所以需要try-catch
- * @param json
- * @param key
- * @return
- * @throws JSONException
- */
- public T getValue(String json, String key) throws JSONException {
- return getValue(new JSONObject(json), key);
- }
- /**从object中获取key对应的值
- * *获取如果T是基本类型容易崩溃,所以需要try-catch
- * @param object
- * @param key
- * @return
- * @throws JSONException
- */
- @SuppressWarnings("unchecked")
- public T getValue(JSONObject object, String key) throws JSONException {
- return (T) object.get(key);
- }
-
- //httpGet/httpPost 内调用方法 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
- /**http请求头
- */
- public class HttpHead extends CookieHandler {
- public HttpHead() {
- }
-
- @Override
- public Map> get(URI uri, Map> requestHeaders) throws IOException {
- String cookie = getCookie();
- Map> map = new HashMap>();
- map.putAll(requestHeaders);
- if (!TextUtils.isEmpty(cookie)) {
- List cList = new ArrayList();
- cList.add(cookie);
- map.put("Cookie", cList);
- }
- return map;
- }
-
- @Override
- public void put(URI uri, Map> responseHeaders) throws IOException {
- List list = responseHeaders.get("Set-Cookie");
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- String cookie = list.get(i);
- if (cookie.startsWith("JSESSIONID")) {
- saveCookie(list.get(i));
- break;
- }
- }
- }
- }
-
- }
-
-
-
-
-}
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/RequestUtil.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/RequestUtil.java
deleted file mode 100644
index bd596728a..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/RequestUtil.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import zuo.biao.apijson.JSONObject;
-import zuo.biao.apijson.JSONRequest;
-import android.content.Context;
-import apijson.demo.application.DemoApplication;
-import apijson.demo.model.Comment;
-import apijson.demo.model.Moment;
-import apijson.demo.model.User;
-import apijson.demo.model.Wallet;
-
-/**请求工具类
- * 设置encode参数只为方便展示,实际使用时并不需要
- * @author Lemon
- */
-public class RequestUtil {
-
- private static Context context;
- static {
- context = DemoApplication.getInstance();
- }
-
- private static final long DEFAULT_MOMENT_ID = 15;
- private static final long DEFAULT_USER_ID = 38710;
-
-
-
- public static JSONObject newPostRequest(boolean encode) {
- Moment data = new Moment();
- data.setUserId(DEFAULT_USER_ID);
- data.setContent(context.getString(R.string.apijson_slogan));
- List list = new ArrayList();
- list.add("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000");
- list.add("http://common.cnblogs.com/images/icon_weibo_24.png");
- data.setPictureList(list);
- return new JSONRequest(data, encode).setTag(Moment.class.getSimpleName());
- }
-
- public static JSONObject newPutRequest(long id, boolean encode) {
- Moment data = new Moment(id <= 0 ? DEFAULT_MOMENT_ID : id);
- // data.setContent(context.getString(R.string.apijson_info));//一般可用这种方式,encode是为了展示方便
- List list = new ArrayList<>();
- list.add((long) 10000);
- list.add((long) 10001);
- JSONObject momentObject = new JSONObject(data, encode);
- momentObject.put("praiseUserIdList+", list, encode);
- momentObject.put("content", context.getString(R.string.apijson_info), encode);
- return new JSONRequest(Moment.class.getSimpleName(), momentObject, encode).setTag(Moment.class.getSimpleName());
- }
-
- public static JSONObject newDeleteRequest(long id, boolean encode) {
- return new JSONRequest(new Moment(id <= 0 ? 10000 : id), encode).setTag(Moment.class.getSimpleName());
- }
-
-
-
-
- public static JSONObject newSingleRequest(long id, boolean encode) {
- return new JSONRequest(new Moment(id <= 0 ? DEFAULT_MOMENT_ID : id), encode);
- }
-
- public static JSONObject newColumnsRequest(long id, boolean encode) {
- JSONObject object = new JSONObject(new Moment(id <= 0 ? DEFAULT_MOMENT_ID : id), encode);
- object.setColumns("id,userId,content");
- return new JSONRequest(Moment.class.getSimpleName(), object, encode);
- }
-
- public static JSONObject newRelyRequest(long id, boolean encode) {
- JSONRequest request = new JSONRequest();
- request.put(new Moment(id <= 0 ? DEFAULT_MOMENT_ID : id), encode);
- request.put(User.class.getSimpleName(), new JSONRequest("id@", "Moment/userId", encode));
- return request;
- }
-
- public static JSONObject newArrayRequest(boolean encode) {
- JSONRequest dataObject = new JSONRequest();
- dataObject.put("name$", "%o%", encode);
- JSONRequest request = new JSONRequest(User.class.getSimpleName(), dataObject, encode);
- return request.toArray(5, 1, User.class.getSimpleName(), encode);
- }
-
- public static JSONObject newComplexRequest(boolean encode) {
- JSONRequest request = new JSONRequest();
-
- List idList = new ArrayList();
- idList.add(DEFAULT_USER_ID);
- idList.add((long) 93793);
- request.put(Moment.class.getSimpleName(), new JSONRequest("userId{}", idList, encode), encode);
-
- request.put(User.class.getSimpleName(), new JSONRequest("id@", "/Moment/userId", encode), encode);
-
- request.add(new JSONRequest(Comment.class.getSimpleName()
- , new JSONRequest("workId@", "[]/Moment/id", encode), encode).
- toArray(3, 0, Comment.class.getSimpleName()), encode);
-
- return request.toArray(3, 0, encode);
- }
-
- public static JSONObject newAccessErrorRequest(boolean encode) {
- return new JSONRequest(new Wallet().setUserId(DEFAULT_USER_ID), encode)
- .setTag(Wallet.class.getSimpleName());
- }
-
- public static JSONObject newAccessPermittedRequest(boolean encode) {
- JSONRequest request = new JSONRequest();
- request.put(new Wallet().setUserId(DEFAULT_USER_ID), encode);
- request.put("currentUserId", DEFAULT_USER_ID, encode);
- request.put("loginPassword", "apijson", encode);
- return request.setTag(Wallet.class.getSimpleName());
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/StringUtil.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/StringUtil.java
deleted file mode 100644
index ef7b29daa..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/StringUtil.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package apijson.demo;
-
-import android.widget.TextView;
-
-/**String工具类
- * @author Lemon
- */
-public class StringUtil extends zuo.biao.apijson.StringUtil {
-
- public static String getString(TextView tv) {
- if (tv == null || tv.getText() == null) {
- return "";
- }
- return getString(tv.getText().toString());
- }
- public static String getTrimedString(TextView tv) {
- return getTrimedString(getString(tv));
- }
- public static String getNoBlankString(TextView tv) {
- return getNoBlankString(getString(tv));
- }
-
- public static boolean isNotEmpty(TextView tv, boolean trim) {
- return isNotEmpty(getString(tv), trim);
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/application/DemoApplication.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/application/DemoApplication.java
deleted file mode 100644
index 863bfb736..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/application/DemoApplication.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.application;
-
-import android.app.Application;
-import android.util.Log;
-import apijson.demo.R;
-
-/**Application
- * @author Lemon
- */
-public class DemoApplication extends Application {
- private static final String TAG = "DemoApplication";
-
-
- private static Application instance;
- public static Application getInstance() {
- return instance;
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
- instance = this;
- Log.d(TAG, "项目启动 >>>>>>>>>>>>>>>>>>>> \n\n");
-
- }
-
-
- /**获取应用名
- * @return
- */
- public String getAppName() {
- return getResources().getString(R.string.app_name);
- }
- /**获取应用版本名(显示给用户看的)
- * @return
- */
- public String getAppVersion() {
- return getResources().getString(R.string.app_version);
- }
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/application/package-info.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/application/package-info.java
deleted file mode 100644
index cdd3651f8..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/application/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * application所在包
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo.application;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/BaseModel.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/BaseModel.java
deleted file mode 100644
index d634d074a..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/BaseModel.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.model;
-
-import java.io.Serializable;
-
-/**基础model,继承它可减少部分代码
- * @author Lemon
- * @use extends BaseModel
- */
-public abstract class BaseModel implements Serializable {
- private static final long serialVersionUID = 7560533944342381808L;
-
- public Long id;
-
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/Comment.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/Comment.java
deleted file mode 100644
index 01611b726..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/Comment.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.model;
-
-/**评论类
- * @author Lemon
- */
-public class Comment extends BaseModel {
- private static final long serialVersionUID = -1011007127735372824L;
-
- public Long workId;
- public Long parentId;
- public Long userId;
- public Long targetUserId;
- public String userName;
- public String targetUserName;
- public String content;
- public Comment() {
- super();
- }
- public Comment(Long id, String content) {
- this();
- this.id = id;
- this.content = content;
- }
-
- public Long getWorkId() {
- return workId;
- }
- public void setWorkId(Long workId) {
- this.workId = workId;
- }
- public Long getParentId() {
- return parentId;
- }
- public void setParentId(Long parentId) {
- this.parentId = parentId;
- }
- public Long getUserId() {
- return userId;
- }
- public void setUserId(Long userId) {
- this.userId = userId;
- }
- public Long getTargetUserId() {
- return targetUserId;
- }
- public void setTargetUserId(Long targetUserId) {
- this.targetUserId = targetUserId;
- }
- public String getUserName() {
- return userName;
- }
- public void setUserName(String userName) {
- this.userName = userName;
- }
- public String getTargetUserName() {
- return targetUserName;
- }
- public void setTargetUserName(String targetUserName) {
- this.targetUserName = targetUserName;
- }
- public String getContent() {
- return content;
- }
- public void setContent(String content) {
- this.content = content;
- }
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/Moment.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/Moment.java
deleted file mode 100644
index dd89e02ae..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/Moment.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.model;
-
-import java.util.List;
-
-/**作品类
- * @author Lemon
- */
-public class Moment extends BaseModel {
- private static final long serialVersionUID = -7437225320551780084L;
-
- private Long userId;
- private String content;
- private String picture;
- private List pictureList;
- private List praiseUserIdList;
- private List commentIdList;
-
- public Moment() {
- super();
- }
- public Moment(long id) {
- this();
- setId(id);
- }
-
- public Long getUserId() {
- return userId;
- }
- public Moment setUserId(Long userId) {
- this.userId = userId;
- return this;
- }
- public String getContent() {
- return content;
- }
- public Moment setContent(String content) {
- this.content = content;
- return this;
- }
- public String getPicture() {
- return picture;
- }
- public Moment setPicture(String picture) {
- this.picture = picture;
- return this;
- }
- public List getPictureList() {
- return pictureList;
- }
- public Moment setPictureList(List pictureList) {
- this.pictureList = pictureList;
- return this;
- }
- public List getPraiseUserIdList() {
- return praiseUserIdList;
- }
- public Moment setPraiseUserIdList(List praiseUserIdList) {
- this.praiseUserIdList = praiseUserIdList;
- return this;
- }
- public List getCommentIdList() {
- return commentIdList;
- }
- public Moment setCommentIdList(List commentIdList) {
- this.commentIdList = commentIdList;
- return this;
- }
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/User.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/User.java
deleted file mode 100644
index 6a7a23f51..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/User.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.model;
-
-import java.util.List;
-
-/**用户类
- * @author Lemon
- */
-public class User extends BaseModel {
- private static final long serialVersionUID = -1635551656020732611L;
-
- public Integer sex;
- public String head;
- public String name;
- public String phone;
- public List pictureList;
-
- /**默认构造方法,JSON等解析时必须要有
- */
- public User() {
- super();
- }
- public User(long id) {
- this();
- this.id = id;
- }
- public User(long id, String name) {
- this(id);
- this.name = name;
- }
-
- public Integer getSex() {
- return sex;
- }
- public User setSex(Integer sex) {
- this.sex = sex;
- return this;
- }
- public String getHead() {
- return head;
- }
- public void setHead(String head) {
- this.head = head;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getPhone() {
- return phone;
- }
- public void setPhone(String phone) {
- this.phone = phone;
- }
- public List getPictureList() {
- return pictureList;
- }
- public void setPictureList(List pictureList) {
- this.pictureList = pictureList;
- }
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/Wallet.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/Wallet.java
deleted file mode 100644
index 43eadb2b5..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/Wallet.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.model;
-
-import java.math.BigDecimal;
-
-/**钱包类
- * @author Lemon
- */
-public class Wallet extends BaseModel {
- private static final long serialVersionUID = 4298571449155754300L;
-
- public Long userId;
- public BigDecimal balance;
-
- /**默认构造方法,JSON等解析时必须要有
- */
- public Wallet() {
- super();
- }
- public Wallet(long id) {
- this();
- this.id = id;
- }
-
- public Wallet setUserId(Long userId) {
- this.userId = userId;
- return this;
- }
- public Long getUserId() {
- return userId;
- }
-
- public BigDecimal getBalance() {
- return balance;
- }
- public void setBalance(BigDecimal balance) {
- this.balance = balance;
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/package-info.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/package-info.java
deleted file mode 100644
index d4c9da7de..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/model/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**model类所在包
- * model对应服务器数据库里table,用于封装请求和解析结果
- * 类名称 : model == table
- * 变量(名称, 类型) : variable == column
- * @warn 在model内不要对变量使用int,boolean,char等基本类型, 用Integer,Boolean,String等对应的对象类型替代
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo.model;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/package-info.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/package-info.java
deleted file mode 100644
index 0da467eb8..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * 管理类或工具类所在包,如果类很多的话可以把它们单独分到一个或多个包
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/ui/RequestActivity.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/ui/RequestActivity.java
deleted file mode 100644
index a00bec330..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/ui/RequestActivity.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.ui;
-
-import static zuo.biao.apijson.StringUtil.UTF_8;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-
-import zuo.biao.apijson.JSON;
-import zuo.biao.apijson.JSONResponse;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnLongClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-import apijson.demo.HttpManager;
-import apijson.demo.HttpManager.OnHttpResponseListener;
-import apijson.demo.R;
-import apijson.demo.StringUtil;
-import apijson.demo.model.Moment;
-import apijson.demo.model.Wallet;
-
-import com.alibaba.fastjson.JSONObject;
-
-/**请求Activity
- * 向服务器发起请求查询或操作相应数据
- * @author Lemon
- */
-public class RequestActivity extends Activity implements OnHttpResponseListener {
- private static final String TAG = "RequestActivity";
-
-
- public static final String INTENT_ID = "INTENT_ID";
- public static final String INTENT_URL = "INTENT_URL";
- public static final String INTENT_METHOD = "INTENT_METHOD";
- public static final String INTENT_REQUEST = "INTENT_REQUEST";
-
- public static final String RESULT_ID = "RESULT_ID";
- public static final String RESULT_URL = "RESULT_URL";
-
- /**
- * @param context
- * @param id
- * @param url
- * @param method
- * @param request
- * @return
- */
- public static Intent createIntent(Context context, long id, String url, String method, JSONObject request) {
- return new Intent(context, RequestActivity.class)
- .putExtra(RequestActivity.INTENT_ID, id)
- .putExtra(RequestActivity.INTENT_URL, url)
- .putExtra(RequestActivity.INTENT_METHOD, method)
- .putExtra(RequestActivity.INTENT_REQUEST, JSON.toJSONString(request));
- }
-
-
-
-
-
- private Activity context;
- private boolean isAlive;
-
- private long id;
- private String url;
- private String method;
- private String request;
-
- private TextView tvRequestResult;
- private ProgressBar pbRequest;
- private EditText etRequestUrl;
- private Button btnRequestRequest;
-
- private String error;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.request_activity);
- context = this;
- isAlive = true;
-
-
- id = getIntent().getLongExtra(INTENT_ID, id);
- url = getIntent().getStringExtra(INTENT_URL);
- method = getIntent().getStringExtra(INTENT_METHOD);
- request = getIntent().getStringExtra(INTENT_REQUEST);
-
- method = StringUtil.getTrimedString(method);
- url = StringUtil.getCorrectUrl(url);
-
-
- tvRequestResult = (TextView) findViewById(R.id.tvRequestResult);
- pbRequest = (ProgressBar) findViewById(R.id.pbRequest);
- etRequestUrl = (EditText) findViewById(R.id.etRequestUrl);
- btnRequestRequest = (Button) findViewById(R.id.btnRequestRequest);
-
-
-
- etRequestUrl.setText(StringUtil.getString(StringUtil.isNotEmpty(url, true)
- ? url : "http://139.196.140.118:8080/"));//TODO 把这个ip地址改成你自己服务器的
- btnRequestRequest.setText(method);
-
- error = String.format(getResources().getString(R.string.request_error), StringUtil.getTrimedString(btnRequestRequest));
-
- request();
-
-
-
- btnRequestRequest.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- request();
- }
- });
- btnRequestRequest.setOnLongClickListener(new OnLongClickListener() {
-
- @Override
- public boolean onLongClick(View v) {
- openWebSite();
- return true;
- }
- });
-
- }
-
-
- /**向服务器发起请求,通过 {@link #onHttpResponse(int, String, Exception)} 返回结果
- */
- private void request() {
- setRequest();
-
- final String fullUrl = getUrl();
-
- tvRequestResult.setText("requesting...\n\n url = " + fullUrl + "\n\n request = \n" + JSON.format(request) + "\n\n\n" + error);
- pbRequest.setVisibility(View.VISIBLE);
-
- if ("get".equals(method)) {
- HttpManager.getInstance().get(fullUrl, request, this);
- } else {
- HttpManager.getInstance().post(fullUrl, request, this);
- }
- }
-
- /**用浏览器请求,只有GET请求才能正常访问
- */
- public void openWebSite() {
- if ("get".endsWith(method) == false) {
- Toast.makeText(context, R.string.browser_can_only_receive_get_response, Toast.LENGTH_LONG).show();
- }
- setRequest();
- String webSite = null;
- try {
- webSite = StringUtil.getNoBlankString(getUrl())
- + URLEncoder.encode(StringUtil.getNoBlankString(request), UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- if (StringUtil.isNotEmpty(webSite, true) == false) {
- Log.e(TAG, "openWebSite StringUtil.isNotEmpty(webSite, true) == false >> return;");
- return;
- }
-
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(webSite)));
- }
-
-
-
-
- private String getUrl() {
- return url + StringUtil.getTrimedString(btnRequestRequest) + "/";
- }
-
-
- public void setRequest() {
- url = StringUtil.getNoBlankString(etRequestUrl);
- Log.d(TAG, "setRequest url = " + url + ";\n request = " + request);
- }
-
-
-
- /*Http请求响应回调函数,返回数据在这里处理
- */
- @Override
- public void onHttpResponse(int requestCode, final String resultJson, final Exception e) {
- Log.d(TAG, "onHttpResponse resultJson = " + resultJson);
- if (e != null) {
- Log.e(TAG, "onHttpResponse e = " + e.getMessage());
- }
- JSONResponse response = new JSONResponse(resultJson);
-
- if ("post".equals(method)) {
- Moment moment = response.getObject(Moment.class);
- id = moment == null ? 0 : moment.getId();
- Log.d(TAG, "onHttpResponse post.equals(method) >> id = " + id);
-
- } else if ("put".equals(method)) {
- response.getJSONResponse(Moment.class.getSimpleName());
- Log.d(TAG, "onHttpResponse put.equals(method) >> moment = " + JSON.toJSONString(response));
-
- } else if ("delete".equals(method)) {
- response = response.getJSONResponse(Moment.class.getSimpleName());
-// if (JSONResponse.isSucceed(response)) {//delete succeed
- id = 0;//reuse default value
-// }
- Log.d(TAG, "onHttpResponse delete.equals(method) >> id = " + id
- + "; isSucceed = " + JSONResponse.isSucceed(response));
-
- } else if ("post_get".equals(method)) {
- Wallet wallet = response.getObject(Wallet.class);
- Log.d(TAG, "onHttpResponse post_get.equals(method) >> wallet = " + JSON.toJSONString(wallet));
- }
-
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- if (isAlive) {
- pbRequest.setVisibility(View.GONE);
- Toast.makeText(context, R.string.received_result, Toast.LENGTH_SHORT).show();
-
- tvRequestResult.setText(e == null || JSON.isJsonCorrect(resultJson)
- ? JSON.format(resultJson) : e.getMessage() + "\n\n\n" + error);
- }
- }
- });
- }
-
-
-
-
- @Override
- public void finish() {
- setResult(RESULT_OK, new Intent().putExtra(RESULT_ID, id).putExtra(RESULT_URL, url));
- super.finish();
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- isAlive = false;
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/ui/SelectActivity.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/ui/SelectActivity.java
deleted file mode 100644
index 796c61def..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/ui/SelectActivity.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.ui;
-
-import zuo.biao.apijson.JSON;
-import zuo.biao.apijson.StringUtil;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.net.Uri;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.Toast;
-import apijson.demo.R;
-import apijson.demo.RequestUtil;
-
-import com.alibaba.fastjson.JSONObject;
-
-/**选择Activity
- * 选择向服务器发起的请求
- * @author Lemon
- */
-public class SelectActivity extends Activity implements OnClickListener {
-
-
- private static final String KEY_ID = "id";
- private static final String KEY_URL = "url";
-
-
- private Activity context;
-
- private long id;
- private String url;
-
- private Button[] buttons;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.select_activity);
- context = this;
-
-
- //读取保存的配置
- SharedPreferences sp = getSharedPreferences(getPackageName() + "_config", Context.MODE_PRIVATE);
- id = sp.getLong(KEY_ID, id);
- url = sp.getString(KEY_URL, null);
-
-
- buttons = new Button[10];
- buttons[0] = (Button) findViewById(R.id.btnSelectPost);
- buttons[1] = (Button) findViewById(R.id.btnSelectPut);
- buttons[2] = (Button) findViewById(R.id.btnSelectDelete);
- buttons[3] = (Button) findViewById(R.id.btnSelectSingle);
- buttons[4] = (Button) findViewById(R.id.btnSelectColumns);
- buttons[5] = (Button) findViewById(R.id.btnSelectRely);
- buttons[6] = (Button) findViewById(R.id.btnSelectArray);
- buttons[7] = (Button) findViewById(R.id.btnSelectComplex);
- buttons[8] = (Button) findViewById(R.id.btnSelectAccessError);
- buttons[9] = (Button) findViewById(R.id.btnSelectAccessPermitted);
-
-
- setRequest();
-
-
- for (int i = 0; i < buttons.length; i++) {
- buttons[i].setOnClickListener(this);
- }
-
- findViewById(R.id.btnSelectUpdateLog).setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
- StringUtil.getCorrectUrl("github.com/TommyLemon/APIJSON/commits/master"))));
- }
- });
-
- }
-
-
-
- /**
- */
- public void setRequest() {
- for (int i = 0; i < buttons.length; i++) {
- buttons[i].setText(JSON.format(getRequest(buttons[i], false)));
- }
- }
-
- /**
- * @param v
- * @return
- */
- public JSONObject getRequest(View v, boolean encode) {
- switch (v.getId()) {
- case R.id.btnSelectPost:
- return RequestUtil.newPostRequest(encode);
- case R.id.btnSelectPut:
- return RequestUtil.newPutRequest(id, encode);
- case R.id.btnSelectDelete:
- return RequestUtil.newDeleteRequest(id, encode);
-
- case R.id.btnSelectSingle:
- return RequestUtil.newSingleRequest(id, encode);
- case R.id.btnSelectColumns:
- return RequestUtil.newColumnsRequest(id, encode);
- case R.id.btnSelectRely:
- return RequestUtil.newRelyRequest(id, encode);
- case R.id.btnSelectArray:
- return RequestUtil.newArrayRequest(encode);
-
- case R.id.btnSelectAccessError:
- return RequestUtil.newAccessErrorRequest(encode);
- case R.id.btnSelectAccessPermitted:
- return RequestUtil.newAccessPermittedRequest(encode);
- default:
- return RequestUtil.newComplexRequest(encode);
- }
- }
-
-
-
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.btnSelectPost:
- select(getRequest(v, true), "post");
- break;
- case R.id.btnSelectPut:
- select(getRequest(v, true), "put");
- break;
- case R.id.btnSelectDelete:
- select(getRequest(v, true), "delete");
- break;
-
- case R.id.btnSelectAccessError:
- select(getRequest(v, true), "post_get");
- break;
- case R.id.btnSelectAccessPermitted:
- select(getRequest(v, true), "post_get");
- break;
-
- default:
- select(getRequest(v, true), "get");
- break;
- }
- }
-
-
- private void select(JSONObject request, String method) {
- startActivityForResult(RequestActivity.createIntent(context, id, url, method, request), REQUEST_TO_REQUEST);
- }
-
-
-
- private static final int REQUEST_TO_REQUEST = 1;
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode != RESULT_OK) {
- return;
- }
- switch (requestCode) {
- case REQUEST_TO_REQUEST:
- if (data == null) {
- Toast.makeText(context, "onActivityResult data == null !!!", Toast.LENGTH_SHORT).show();
- } else {
- id = data.getLongExtra(RequestActivity.RESULT_ID, id);
- url = data.getStringExtra(RequestActivity.RESULT_URL);
-
- setRequest();
-
- //保存配置
- getSharedPreferences(getPackageName() + "_config", Context.MODE_PRIVATE)
- .edit()
- .remove(KEY_ID)
- .putLong(KEY_ID, id)
- .remove(KEY_URL)
- .putString(KEY_URL, url)
- .commit();
- }
- break;
- default:
- break;
- }
- }
-
-
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/ui/package-info.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/ui/package-info.java
deleted file mode 100644
index c31dbee2e..000000000
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONTest/src/apijson/demo/ui/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * 界面相关类所在包
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo.ui;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/.gitignore b/APIJSON(Android)/APIJSON(AndroidStudio)/.gitignore
deleted file mode 100644
index c6cbe562a..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-*.iml
-.gradle
-/local.properties
-/.idea/workspace.xml
-/.idea/libraries
-.DS_Store
-/build
-/captures
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/.name b/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/.name
deleted file mode 100644
index 6bd5830b0..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-APIJSON(AndroidStudio)
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/compiler.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/compiler.xml
deleted file mode 100644
index 96cc43efa..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/compiler.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/copyright/profiles_settings.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/copyright/profiles_settings.xml
deleted file mode 100644
index e7bedf337..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/copyright/profiles_settings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/dictionaries/Tommy.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/dictionaries/Tommy.xml
deleted file mode 100644
index b4ca1e7c3..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/dictionaries/Tommy.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/encodings.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/encodings.xml
deleted file mode 100644
index 97626ba45..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/encodings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/gradle.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/gradle.xml
deleted file mode 100644
index 7cc22387e..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/gradle.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/misc.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/misc.xml
deleted file mode 100644
index f0ee78c38..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/misc.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Spelling
-
-
-
-
- SpellCheckingInspection
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/modules.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/modules.xml
deleted file mode 100644
index 4ed2ec4bf..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/modules.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/runConfigurations.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460d8..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/.name b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/.name
deleted file mode 100644
index 8318c86b3..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-Test
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/compiler.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/compiler.xml
deleted file mode 100644
index 96cc43efa..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/compiler.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/copyright/profiles_settings.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/copyright/profiles_settings.xml
deleted file mode 100644
index e7bedf337..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/copyright/profiles_settings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/encodings.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/encodings.xml
deleted file mode 100644
index 97626ba45..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/encodings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/gradle.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/gradle.xml
deleted file mode 100644
index 7cc22387e..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/gradle.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/fastjson_1_2_24.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/fastjson_1_2_24.xml
deleted file mode 100644
index cc6fbb576..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/fastjson_1_2_24.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/hamcrest_core_1_3.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/hamcrest_core_1_3.xml
deleted file mode 100644
index 5e4fc4082..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/hamcrest_core_1_3.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/junit_4_12.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/junit_4_12.xml
deleted file mode 100644
index 7c37c6a5f..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/junit_4_12.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/okhttp_2_1_0.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/okhttp_2_1_0.xml
deleted file mode 100644
index 5dea54ce7..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/okhttp_2_1_0.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/okio_1_0_0.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/okio_1_0_0.xml
deleted file mode 100644
index 90d4003a1..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/libraries/okio_1_0_0.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/misc.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/misc.xml
deleted file mode 100644
index fcad34113..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/misc.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- Spelling
-
-
-
-
- SpellCheckingInspection
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/modules.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/modules.xml
deleted file mode 100644
index c8b4e8041..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/modules.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/runConfigurations.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460d8..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/workspace.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/workspace.xml
deleted file mode 100644
index cb14d68cf..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/.idea/workspace.xml
+++ /dev/null
@@ -1,2604 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1490012114001
-
- 1490012114001
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/.gitignore b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/.gitignore
deleted file mode 100644
index 796b96d1c..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/build.gradle b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/build.gradle
deleted file mode 100644
index 6f78ee4c7..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/build.gradle
+++ /dev/null
@@ -1,26 +0,0 @@
-apply plugin: 'com.android.library'
-
-android {
- compileSdkVersion 23
- buildToolsVersion '23.0.2'
- defaultConfig {
- minSdkVersion 15
- targetSdkVersion 22
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
- productFlavors {
- }
-}
-
-dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- testCompile 'junit:junit:4.12'
- compile files('libs/fastjson-1.2.24.jar')
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/libs/fastjson-1.2.24.jar b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/libs/fastjson-1.2.24.jar
deleted file mode 100644
index 4a6652fb5..000000000
Binary files a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/libs/fastjson-1.2.24.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/proguard-rules.pro b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/proguard-rules.pro
deleted file mode 100644
index 90cb5eb39..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/proguard-rules.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Users/Tommy/Library/Android/sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/androidTest/java/zuo/biao/apijson/client/ApplicationTest.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/androidTest/java/zuo/biao/apijson/client/ApplicationTest.java
deleted file mode 100644
index e44a51bfd..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/androidTest/java/zuo/biao/apijson/client/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package zuo.biao.apijson.client;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * Testing Fundamentals
- */
-public class ApplicationTest extends ApplicationTestCase {
- public ApplicationTest() {
- super(Application.class);
- }
-}
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/AndroidManifest.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/AndroidManifest.xml
deleted file mode 100644
index 93e2d0fcb..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSON.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSON.java
deleted file mode 100644
index 0a9f38cdf..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSON.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import java.util.List;
-
-import android.util.Log;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.parser.Feature;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-
-/**阿里json封装类 防止解析时异常
- * @author Lemon
- */
-public class JSON {
- private static final String TAG = "JSON";
-
- /**判断json格式是否正确
- * @param s
- * @return
- */
- public static boolean isJsonCorrect(String s) {
- Log.i(TAG, "isJsonCorrect <<<< " + s + " >>>>>>>");
- if (s == null
- // || s.equals("[]")
- // || s.equals("{}")
- || s.equals("")
- || s.equals("[null]")
- || s.equals("{null}")
- || s.equals("null")) {
- return false;
- }
- return true;
- }
-
- /**获取有效的json
- * @param s
- * @return
- */
- public static String getCorrectJson(String s) {
- return getCorrectJson(s, false);
- }
- /**获取有效的json
- * @param s
- * @param isArray
- * @return
- */
- public static String getCorrectJson(String s, boolean isArray) {
- s = StringUtil.getTrimedString(s);
- // if (isArray) {
- // if (s.startsWith("\"")) {
- // s = s.substring(1);
- // }
- // if (s.endsWith("\"")) {
- // s = s.substring(0, s.length() - 1);
- // }
- // }
- return s;//isJsonCorrect(s) ? s : null;
- }
-
- /**json转JSONObject
- * @param json
- * @return
- */
- public static JSONObject parseObject(Object obj) {
- return parseObject(toJSONString(obj));
- }
- /**json转JSONObject
- * @param json
- * @return
- */
- public static JSONObject parseObject(String json) {
- int features = com.alibaba.fastjson.JSON.DEFAULT_PARSER_FEATURE;
- features |= Feature.OrderedField.getMask();
- return parseObject(json, features);
- }
- /**json转JSONObject
- * @param json
- * @param features
- * @return
- */
- public static JSONObject parseObject(String json, int features) {
- try {
- return com.alibaba.fastjson.JSON.parseObject(getCorrectJson(json), JSONObject.class, features);
- } catch (Exception e) {
- Log.i(TAG, "parseObject catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**JSONObject转实体类
- * @param object
- * @param clazz
- * @return
- */
- public static T parseObject(JSONObject object, Class clazz) {
- return parseObject(toJSONString(object), clazz);
- }
- /**json转实体类
- * @param json
- * @param clazz
- * @return
- */
- public static T parseObject(String json, Class clazz) {
- try {
- int features = com.alibaba.fastjson.JSON.DEFAULT_PARSER_FEATURE;
- features |= Feature.OrderedField.getMask();
- return com.alibaba.fastjson.JSON.parseObject(getCorrectJson(json), clazz, features);
- } catch (Exception e) {
- Log.i(TAG, "parseObject catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**json转JSONArray
- * @param json
- * @return
- */
- public static JSONArray parseArray(String json) {
- try {
- return com.alibaba.fastjson.JSON.parseArray(getCorrectJson(json, true));
- } catch (Exception e) {
- Log.i(TAG, "parseArray catch \n" + e.getMessage());
- }
- return null;
- }
- /**JSONArray转实体类列表
- * @param array
- * @param clazz
- * @return
- */
- public static List parseArray(JSONArray array, Class clazz) {
- return parseArray(toJSONString(array), clazz);
- }
- /**json转实体类列表
- * @param json
- * @param clazz
- * @return
- */
- public static List parseArray(String json, Class clazz) {
- try {
- return com.alibaba.fastjson.JSON.parseArray(getCorrectJson(json, true), clazz);
- } catch (Exception e) {
- Log.i(TAG, "parseArray catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**实体类转json
- * @param obj
- * @return
- */
- public static String toJSONString(Object obj) {
- if (obj instanceof String) {
- return (String) obj;
- }
- try {
- return com.alibaba.fastjson.JSON.toJSONString(obj);
- } catch (Exception e) {
- Log.i(TAG, "toJSONString catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**实体类转json
- * @param obj
- * @param features
- * @return
- */
- public static String toJSONString(Object obj, SerializerFeature... features) {
- if (obj instanceof String) {
- return (String) obj;
- }
- try {
- return com.alibaba.fastjson.JSON.toJSONString(obj, features);
- } catch (Exception e) {
- Log.i(TAG, "toJSONString catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**格式化,显示更好看
- * @param json
- * @return
- */
- public static String format(String json) {
- return format(parseObject(json));
- }
- /**格式化,显示更好看
- * @param object
- * @return
- */
- public static String format(JSONObject object) {
- return toJSONString(object, SerializerFeature.PrettyFormat);
- }
-
- /**判断是否为JSONObject
- * @param obj instanceof String ? parseObject
- * @return
- */
- public static boolean isJSONObject(Object obj) {
- if (obj instanceof JSONObject) {
- return true;
- }
- if (obj instanceof String) {
- try {
- JSONObject json = parseObject((String) obj);
- return json != null && json.isEmpty() == false;
- } catch (Exception e) {
- //太长 System.out.println(TAG + "select while (rs.next()){ >> i = "
- // + i + " try { json = JSON.parse((String) value);"
- // + ">> } catch (Exception e) {\n" + e.getMessage());
- }
- }
-
- return false;
- }
- /**判断是否为JSONArray
- * @param obj instanceof String ? parseArray
- * @return
- */
- public static boolean isJSONArray(Object obj) {
- if (obj instanceof JSONArray) {
- return true;
- }
- if (obj instanceof String) {
- try {
- JSONArray json = parseArray((String) obj);
- return json != null && json.isEmpty() == false;
- } catch (Exception e) {
- //太长 System.out.println(TAG + "select while (rs.next()){ >> i = "
- // + i + " try { json = JSON.parse((String) value);"
- // + ">> } catch (Exception e) {\n" + e.getMessage());
- }
- }
-
- return false;
- }
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSONObject.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSONObject.java
deleted file mode 100644
index 9b109a3f0..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSONObject.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import static zuo.biao.apijson.StringUtil.UTF_8;
-import static zuo.biao.apijson.StringUtil.bigAlphaPattern;
-import static zuo.biao.apijson.StringUtil.namePattern;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.Set;
-
-
-/**use this class instead of com.alibaba.fastjson.JSONObject, not encode in default cases
- * @author Lemon
- */
-public class JSONObject extends com.alibaba.fastjson.JSONObject {
- private static final long serialVersionUID = 8907029699680768212L;
-
- /**ordered
- */
- public JSONObject() {
- super(true);
- }
- /**transfer Object to JSONObject
- * encode = false;
- * @param object
- * @see {@link #JSONObject(Object, boolean)}
- */
- public JSONObject(Object object) {
- this(object, false);
- }
- /**transfer Object to JSONObject
- * @param object
- * @param encode
- * @see {@link #JSONObject(String, boolean)}
- */
- public JSONObject(Object object, boolean encode) {
- this(toJSONString(object), encode);
- }
- /**parse JSONObject with JSON String
- * encode = false;
- * @param json
- * @see {@link #JSONObject(String, boolean)}
- */
- public JSONObject(String json) {
- this(json, false);
- }
- /**parse JSONObject with JSON String
- * @param json
- * @param encode
- * @see {@link #JSONObject(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject(String json, boolean encode) {
- this(parseObject(json), encode);
- }
- /**transfer com.alibaba.fastjson.JSONObject to JSONObject
- * encode = false;
- * @param object
- * @see {@link #JSONObject(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject(com.alibaba.fastjson.JSONObject object) {
- this(object, false);
- }
- /**transfer com.alibaba.fastjson.JSONObject to JSONObject
- * @param object
- * @param encode
- * @see {@link #add(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject(com.alibaba.fastjson.JSONObject object, boolean encode) {
- this();
- add(object, encode);
- }
-
-
-
-
- /**put key-value in object into this
- * encode = false;
- * @param object
- * @return {@link #add(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject add(com.alibaba.fastjson.JSONObject object) {
- return add(object, false);
- }
- /**put key-value in object into this
- * @param object
- * @param encode
- * @return this
- */
- public JSONObject add(com.alibaba.fastjson.JSONObject object, boolean encode) {
- Set set = object == null ? null : object.keySet();
- if (set != null) {
- for (String key : set) {
- put(key, object.get(key), encode);
- }
- }
- return this;
- }
-
-
-
- /**
- * @param key if decode && key instanceof String, key = URLDecoder.decode((String) key, UTF_8)
- * @param decode if decode && value instanceof String, value = URLDecoder.decode((String) value, UTF_8)
- * @return
- */
- public Object get(Object key, boolean decode) {
- if (decode) {
- if (key instanceof String) {
- if (((String) key).endsWith("+") || ((String) key).endsWith("-")) {
- try {//多层encode导致内部Comment[]传到服务端decode后最终变为Comment%5B%5D
- key = URLDecoder.decode((String) key, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- return null;
- }
- }
- }
- Object value = super.get(key);
- if (value instanceof String) {
- try {
- value = URLDecoder.decode((String) value, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
- return value;
- }
- return super.get(key);
- }
-
- /**
- * encode = false
- * @param value
- * @return {@link #put(String, boolean)}
- */
- public Object put(Object value) {
- return put(value, false);
- }
- /**
- * key = value.getClass().getSimpleName()
- * @param value
- * @param encode
- * @return {@link #put(String, Object, boolean)}
- */
- public Object put(Object value, boolean encode) {
- return put(null, value, encode);
- }
- /**
- * @param key if StringUtil.isNotEmpty(key, true) == false,
- *
key = value == null ? null : value.getClass().getSimpleName();
- *
>> if decode && key instanceof String, key = URLDecoder.decode((String) key, UTF_8)
- * @param value URLEncoder.encode((String) value, UTF_8);
- * @param encode if value instanceof String, value = URLEncoder.encode((String) value, UTF_8);
- * @return
- */
- public Object put(String key, Object value, boolean encode) {
- if (StringUtil.isNotEmpty(key, true) == false) {
- key = value == null ? null : value.getClass().getSimpleName();
- }
- if (encode) {
- if (key.endsWith("+") || key.endsWith("-")) {
- try {//多层encode导致内部Comment[]传到服务端decode后最终变为Comment%5B%5D
- key = URLEncoder.encode(key, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
- if (value instanceof String) {//只在value instanceof String时encode key?{@link #get(Object, boolean)}内做不到
- try {
- value = URLEncoder.encode((String) value, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
- }
- return super.put(key, value);
- }
-
-
-
- //judge <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- public static final String KEY_ARRAY = "[]";
-
- /**判断是否为Array的key
- * @param key
- * @return
- */
- public static boolean isArrayKey(String key) {
- return key != null && key.endsWith(KEY_ARRAY);
- }
- /**判断是否为对应Table的key
- * @param key
- * @return
- */
- public static boolean isTableKey(String key) {
- return isWord(key) && bigAlphaPattern.matcher(key.substring(0, 1)).matches();
- }
- /**判断是否为词,只能包含字母,数字或下划线
- * @param key
- * @return
- */
- public static boolean isWord(String key) {
- return StringUtil.isNotEmpty(key, false) && namePattern.matcher(key).matches();
- }
- //judge >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- public static final String KEY_COLUMNS = "@columns";//@key关键字都放这个类
-
- /**set columns need to be returned
- * @param columns "column0,column1,column2..."
- * @return
- */
- public JSONObject setColumns(String columns) {
- put(KEY_COLUMNS, columns);
- return this;
- }
- public String getColumns() {
- return getString(KEY_COLUMNS);
- }
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSONRequest.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSONRequest.java
deleted file mode 100644
index 75db0dc3c..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSONRequest.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-/**encapsulator for request JSONObject, encode in default cases
- * @author Lemon
- * @see #toArray
- * @use JSONRequest request = new JSONRequest(...);
- *
request.put(...);//not a must
- *
request.toArray(...);//not a must
- */
-public class JSONRequest extends JSONObject {
-
- private static final long serialVersionUID = -2223023180338466812L;
-
- public JSONRequest() {
- super();
- }
- /**
- * encode = true
- * @param object
- * @see {@link #JSONRequest(String, Object)}
- */
- public JSONRequest(Object object) {
- this(null, object);
- }
- /**
- * encode = true
- * @param name
- * @param object
- * @see {@link #JSONRequest(String, Object, boolean)}
- */
- public JSONRequest(String name, Object object) {
- this(name, object, true);
- }
- /**
- * @param object
- * @param encode
- * @see {@link #JSONRequest(String, Object, boolean)}
- */
- public JSONRequest(Object object, boolean encode) {
- this(null, object, encode);
- }
- /**
- * @param name
- * @param object
- * @param encode
- * @see {@link #put(String, Object, boolean)}
- */
- public JSONRequest(String name, Object object, boolean encode) {
- this();
- put(name, object, encode);
- }
-
-
-
-
-
-
- public static final String KEY_TAG = "tag";
-
- public JSONObject setTag(String tag) {
- put(KEY_TAG, tag);
- return this;
- }
- public String getTag() {
- return getString(KEY_TAG);
- }
-
-
- //array object <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final String KEY_COUNT = "count";
- public static final String KEY_PAGE = "page";
-
- public JSONRequest setCount(int count) {
- put(KEY_COUNT, count);
- return this;
- }
- public int getCount() {
- return getIntValue(KEY_COUNT);
- }
-
- public JSONRequest setPage(int page) {
- put(KEY_PAGE, page);
- return this;
- }
- public int getPage() {
- return getIntValue(KEY_PAGE);
- }
- //array object >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
- /**
- * @param value
- * @param parts path = parts[0] + "/" + parts[1] + "/" + parts[2] + ...
- * @return
- */
- public Object putPath(String key, String... parts) {
- String path = "";
- if (parts != null) {
- for (int i = 0; i < parts.length; i++) {
- path += (i > 0 ? "/" : "") + parts[i];
- }
- }
- return put(key, path);
- }
-
- // 导致JSONObject add >> get = null
- // /**
- // * decode = true
- // * @param key
- // * return {@link #get(Object, boolean)}
- // */
- // @Override
- // public Object get(Object key) {
- // return get(key, true);
- // }
-
- /**
- * encode = true
- * @param value
- * @return {@link #put(String, boolean)}
- */
- public Object put(Object value) {
- return put(value, true);
- }
- /**
- * encode = true
- * @param key
- * @param value
- * return {@link #put(String, Object, boolean)}
- */
- @Override
- public Object put(String key, Object value) {
- return put(key, value, true);
- }
-
-
- /**create a parent JSONObject named KEY_ARRAY
- * encode = true;
- * @param count
- * @param page
- * @return {@link #toArray(int, int, boolean)}
- */
- public JSONRequest toArray(int count, int page) {
- return toArray(count, page, true);
- }
- /**create a parent JSONObject named KEY_ARRAY
- * encode = true;
- * @param count
- * @param page
- * @return {@link #toArray(int, int, String, boolean)}
- */
- public JSONRequest toArray(int count, int page, boolean encode) {
- return toArray(count, page, null, encode);
- }
- /**create a parent JSONObject named name+KEY_ARRAY
- * encode = true;
- * @param count
- * @param page
- * @param name
- * @return {@link #toArray(int, int, String, boolean)}
- */
- public JSONRequest toArray(int count, int page, String name) {
- return toArray(count, page, name, true);
- }
- /**create a parent JSONObject named name+KEY_ARRAY
- * @param count
- * @param page
- * @param name
- * @param encode
- * @return {name+KEY_ARRAY : this}
- */
- public JSONRequest toArray(int count, int page, String name, boolean encode) {
- return new JSONRequest(StringUtil.getString(name) + KEY_ARRAY, this.setCount(count).setPage(page), encode);
- }
-
-
- /**设置搜索
- * @param key
- * @param value
- * @see {@link #putSearch(String, String, int)}
- */
- public void putSearch(String key, String value) {
- putSearch(key, value, SEARCH_TYPE_CONTAIN_FULL);
- }
- /**设置搜索
- * encode = true
- * @param key
- * @param value
- * @param type
- * @see {@link #putSearch(String, String, int, boolean)}
- */
- public void putSearch(String key, String value, int type) {
- putSearch(key, value, type, true);
- }
- /**设置搜索
- * @param key
- * @param value
- * @param type
- * @param encode
- */
- public void putSearch(String key, String value, int type, boolean encode) {
- if (key == null) {
- key = "";
- }
- if (key.endsWith("$") == false) {
- key += "$";
- }
- put(key, getSearch(value, type), encode);
- }
-
- public static final int SEARCH_TYPE_CONTAIN_FULL = 0;
- public static final int SEARCH_TYPE_CONTAIN_ORDER = 1;
- public static final int SEARCH_TYPE_CONTAIN_SINGLE = 2;
- public static final int SEARCH_TYPE_CONTAIN_ANY = 3;
- public static final int SEARCH_TYPE_START = 4;
- public static final int SEARCH_TYPE_END = 5;
- public static final int SEARCH_TYPE_START_SINGLE = 6;
- public static final int SEARCH_TYPE_END_SINGLE = 7;
- public static final int SEARCH_TYPE_PART_MATCH = 8;
- /**
- * SQL中NOT LIKE就行??
- */
- public static final int SEARCH_TYPE_NO_CONTAIN = 9;
- /**
- * SQL中NOT LIKE就行??
- */
- public static final int SEARCH_TYPE_NO_PART_MATCH = 10;
- /**获取搜索值
- * @param key
- * @return
- */
- public static String getSearch(String key) {
- return getSearch(key, SEARCH_TYPE_CONTAIN_FULL);
- }
- /**获取搜索值
- * @param key
- * @param type
- * @return
- */
- public static String getSearch(String key, int type) {
- return getSearch(key, type, true);
- }
- /**获取搜索值
- * @param key
- * @param type
- * @param ignoreCase
- * @return
- */
- public static String getSearch(String key, int type, boolean ignoreCase) {
- if (key == null) {
- return null;
- }
- switch (type) {
- case SEARCH_TYPE_CONTAIN_SINGLE:
- return "_" + key + "_";
- case SEARCH_TYPE_CONTAIN_ORDER:
- char[] cs = key.toCharArray();
- if (cs == null) {
- return null;
- }
- String s = "%";
- for (int i = 0; i < cs.length; i++) {
- s += cs[i] + "%";
- }
- return s;
- case SEARCH_TYPE_START:
- return key + "%";
- case SEARCH_TYPE_END:
- return "%" + key;
- case SEARCH_TYPE_START_SINGLE:
- return key + "_";
- case SEARCH_TYPE_END_SINGLE:
- return "_" + key;
- case SEARCH_TYPE_NO_CONTAIN:
- return "[^" + key + "]";
- case SEARCH_TYPE_NO_PART_MATCH:
- cs = key.toCharArray();
- if (cs == null) {
- return null;
- }
- s = "";
- for (int i = 0; i < cs.length; i++) {
- s += getSearch("" + cs[i], SEARCH_TYPE_NO_CONTAIN, ignoreCase);
- }
- return s;
- default:
- return "%" + key + "%";
- }
- }
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSONResponse.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSONResponse.java
deleted file mode 100644
index 0dca2a3f3..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/JSONResponse.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import static zuo.biao.apijson.StringUtil.bigAlphaPattern;
-
-import java.util.List;
-import java.util.Set;
-
-import android.annotation.SuppressLint;
-import android.util.Log;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-/**parser for response JSON String
- * @author Lemon
- * @see #getList
- * @see #toArray
- * @use JSONResponse response = new JSONResponse(...);
- *
JSONArray array = JSONResponse.toArray(response.getJSONObject(KEY_ARRAY));//not a must
- *
User user = JSONResponse.getObject(response, User.class);//not a must
- *
List list = JSONResponse.getList(response.getJSONObject("Comment[]"), Comment.class);//not a must
- */
-@SuppressWarnings("serial")
-public class JSONResponse extends zuo.biao.apijson.JSONObject {
- private static final String TAG = "JSONResponse";
-
- public JSONResponse() {
- super();
- }
- public JSONResponse(String json) {
- this(parseObject(json));
- }
- public JSONResponse(JSONObject object) {
- super(format(object));
- }
-
- //状态信息,非GET请求获得的信息<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final int STATUS_SUCCEED = 200;
-
-
- public static final String KEY_ID = "id";
- public static final String KEY_STATUS = "status";
- public static final String KEY_COUNT = "count";
- public static final String KEY_MESSAGE = "message";
-
- /**获取id
- * @return
- */
- public long getId() {
- return getLongValue(KEY_ID);
- }
- /**获取状态
- * @return
- */
- public int getStatus() {
- return getIntValue(KEY_STATUS);
- }
- /**获取数量
- * @return
- */
- public int getCount() {
- return getIntValue(KEY_COUNT);
- }
- /**获取信息
- * @return
- */
- public String getMessage() {
- return getString(KEY_MESSAGE);
- }
-
- /**是否成功
- * @return
- */
- public boolean isSucceed() {
- return isSucceed(getStatus());
- }
- /**是否成功
- * @param status
- * @return
- */
- public static boolean isSucceed(int status) {
- return status == STATUS_SUCCEED;
- }
- /**是否成功
- * @param response
- * @return
- */
- public static boolean isSucceed(JSONResponse response) {
- return response != null && response.isSucceed();
- }
-
- /**校验服务端是否存在table
- * @return
- */
- public boolean isExist() {
- return isExist(getCount());
- }
- /**校验服务端是否存在table
- * @param count
- * @return
- */
- public static boolean isExist(int count) {
- return count > 0;
- }
- /**校验服务端是否存在table
- * @param response
- * @return
- */
- public static boolean isExist(JSONResponse response) {
- return response != null && response.isExist();
- }
-
- /**获取内部的JSONResponse
- * @param key
- * @return
- */
- public JSONResponse getJSONResponse(String key) {
- return getObject(key, JSONResponse.class);
- }
- //状态信息,非GET请求获得的信息>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
- /**
- * key = clazz.getSimpleName()
- * @param clazz
- * @return
- */
- public T getObject(Class clazz) {
- return getObject(clazz == null ? "" : clazz.getSimpleName(), clazz);
- }
- /**
- * @param key
- * @param clazz
- * @return
- */
- public T getObject(String key, Class clazz) {
- return getObject(this, key, clazz);
- }
- /**
- * @param object
- * @param key
- * @param clazz
- * @return
- */
- public static T getObject(JSONObject object, String key, Class clazz) {
- return toObject(object == null ? null : object.getJSONObject(key), clazz);
- }
-
- /**
- * @param clazz
- * @return
- */
- public T toObject(Class clazz) {
- return toObject(this, clazz);
- }
- /**
- * @param object
- * @param clazz
- * @return
- */
- public static T toObject(JSONObject object, Class clazz) {
- return JSON.parseObject(JSON.toJSONString(object), clazz);
- }
-
-
-
-
- /**
- * key = KEY_ARRAY
- * @param clazz
- * @return
- */
- public List getList(Class clazz) {
- return getList(KEY_ARRAY, clazz);
- }
- /**
- * arrayObject = this
- * @param key
- * @param clazz
- * @return
- */
- public List getList(String key, Class clazz) {
- return getList(this, key, clazz);
- }
-
- /**
- * key = KEY_ARRAY
- * @param object
- * @param clazz
- * @return
- */
- public static List getList(JSONObject object, Class clazz) {
- return getList(object, KEY_ARRAY, clazz);
- }
- /**
- * @param object
- * @param key
- * @param clazz
- * @return
- */
- public static List getList(JSONObject object, String key, Class clazz) {
- Object obj = object == null ? null : object.get(replaceArray(key));
- if (obj == null) {
- return null;
- }
- return obj instanceof JSONArray ? JSON.parseArray((JSONArray) obj, clazz) : toList((JSONObject) obj, clazz);
- }
- /**
- * @param clazz
- * @return
- */
- public List toList(Class clazz) {
- return toList(this, clazz);
- }
- /**
- * @param arrayObject
- * @param clazz
- * @return
- */
- public static List toList(JSONObject arrayObject, Class clazz) {
- return clazz == null ? null : JSON.parseArray(JSON.toJSONString(
- toArray(arrayObject, clazz.getSimpleName())), clazz);
- }
-
- /**
- * key = KEY_ARRAY
- * @param className
- * @return
- */
- public JSONArray getArray(String className) {
- return getArray(KEY_ARRAY, className);
- }
- /**
- * @param key
- * @param className
- * @return
- */
- public JSONArray getArray(String key, String className) {
- return getArray(this, key, className);
- }
- /**
- * @param object
- * @param key
- * @param className
- * @return
- */
- public static JSONArray getArray(JSONObject object, String className) {
- return getArray(object, KEY_ARRAY, className);
- }
- /**
- * key = KEY_ARRAY
- * @param object
- * @param className
- * @return
- */
- public static JSONArray getArray(JSONObject object, String key, String className) {
- Object obj = object == null ? null : object.get(replaceArray(key));
- if (obj == null) {
- return null;
- }
- return obj instanceof JSONArray ? (JSONArray) obj : toArray((JSONObject) obj, className);
- }
-
- /**
- * @param className
- * @return
- */
- public JSONArray toArray(String className) {
- return toArray(this, className);
- }
- /**
- * @param arrayObject
- * @param className
- * @return
- */
- public static JSONArray toArray(JSONObject arrayObject, String className) {
- Set set = arrayObject == null ? null : arrayObject.keySet();
- if (set == null || set.isEmpty()) {
- return null;
- }
-
- // [{...},{...},...]
- String parentString = StringUtil.getTrimedString(JSON.toJSONString(arrayObject));
- if (parentString.isEmpty()) {
- return null;
- }
- if (parentString.startsWith("[")) {
- if (parentString.endsWith("]") == false) {
- parentString += "]";
- }
- return JSON.parseArray(parentString);
- }
-
- //{"0":{Table:{...}}, "1":{Table:{...}}...}
-
- className = StringUtil.getTrimedString(className);
- boolean isContainer = true;
-
- JSONArray array = new JSONArray(set.size());
- JSONObject value;
- boolean isFirst = true;
- int index;
- for (String key : set) {//0, 1, 2,...
- value = StringUtil.isNumer(key) == false ? null : arrayObject.getJSONObject(key);// Table:{}
- if (value != null) {
- try {
- index = Integer.valueOf(0 + key);
- if (isFirst && className.isEmpty() == false && value.containsKey(className)) {// 判断是否需要提取table
- isContainer = false;
- }
- array.set(index, isContainer ? value : value.getJSONObject(className));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- isFirst = false;
- }
- return array;
- }
-
-
-
- // /**将Table[]:{0:{Table:{}}, 1:{Table:{}}...} 转化为 tableList:[{}, {}]
- // * @return
- // */
- // public JSONObject format() {
- // return format(this);
- // }
- /**将Table[]:{0:{Table:{}}, 1:{Table:{}}...} 转化为 tableList:[{}, {}]
- * @param target
- * @param response
- * @return
- */
- public static JSONObject format(final JSONObject response) {
- Log.i(TAG, "format response = \n" + JSON.toJSONString(response));
- if (response == null || response.isEmpty()) {
- Log.i(TAG, "format response == null || response.isEmpty() >> return response;");
- return response;
- }
- JSONObject transferredObject = new JSONObject(true);
-
- Set set = response.keySet();
- if (set != null) {
- Object value;
- String arrayKey;
- for (String key : set) {
- value = response.get(key);
- if (value instanceof JSONArray) {//转化JSONArray内部的APIJSON Array
- transferredObject.put(key, format((JSONArray) value));
- } else if (value instanceof JSONObject) {//APIJSON Array转为常规JSONArray
- if (isArrayKey(key)) {//APIJSON Array转为常规JSONArray
- arrayKey = key.substring(0, key.indexOf(KEY_ARRAY));
- transferredObject.put(getArrayKey(arrayKey), format(toArray((JSONObject) value, arrayKey)));
- } else {//常规JSONObject,往下一级提取
- transferredObject.put(key, format((JSONObject) value));
- }
- } else {//其它Object,直接填充
- transferredObject.put(key, value);
- }
- }
- }
-
- Log.i(TAG, "format return transferredObject = " + JSON.toJSONString(transferredObject));
- return transferredObject;
- }
- /**
- * @param responseArray
- * @return
- */
- public static JSONArray format(final JSONArray responseArray) {
- Log.i(TAG, "format responseArray = \n" + JSON.toJSONString(responseArray));
- if (responseArray == null || responseArray.isEmpty()) {
- Log.i(TAG, "format responseArray == null || responseArray.isEmpty() >> return response;");
- return responseArray;
- }
- JSONArray transferredArray = new JSONArray();
-
- Object value;
- for (int i = 0; i < responseArray.size(); i++) {
- value = responseArray.get(i);
- if (value instanceof JSONArray) {//转化JSONArray内部的APIJSON Array
- transferredArray.add(format((JSONArray) value));
- } else if (value instanceof JSONObject) {//JSONObject,往下一级提取
- transferredArray.add(format((JSONObject) value));
- } else {//其它Object,直接填充
- transferredArray.add(responseArray.get(i));
- }
- }
-
- Log.i(TAG, "format return transferredArray = " + JSON.toJSONString(transferredArray));
- return transferredArray;
- }
-
- /**替换key+KEY_ARRAY为keyList
- * @param key
- * @return isArrayKey(key) ? getArrayKey(...) : key
- */
- public static String replaceArray(String key) {
- if (isArrayKey(key)) {
- return getArrayKey(key.substring(0, key.indexOf(KEY_ARRAY)));
- }
- return key;
- }
- /**获取列表变量名
- * @param key => StringUtil.getNoBlankString(key)
- * @return empty ? "list" : key + "List" 且首字母小写
- */
- @SuppressLint("DefaultLocale")
- public static String getArrayKey(String key) {
- key = StringUtil.getNoBlankString(key);
- if (key.isEmpty()) {
- return "list";
- }
-
- String first = key.substring(0, 1);
- if (bigAlphaPattern.matcher(first).matches()) {
- key = first.toLowerCase() + key.substring(1, key.length());
- }
- return key + "List";
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/RequestMethod.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/RequestMethod.java
deleted file mode 100644
index 4ff717bbf..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/RequestMethod.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-/**请求方法,对应org.springframework.web.bind.annotation.RequestMethod,多出一个POST_GET方法
- * @author Lemon
- */
-public enum RequestMethod {
-
- /**
- * 常规获取数据方式
- */
- GET,
-
- /**
- * 通过POST来HEAD数据,不显示请求内容和返回结果,一般用于对安全要求比较高的请求
- */
- POST_HEAD,
-
- /**
- * 通过POST来GET数据,不显示请求内容和返回结果,一般用于对安全要求比较高的请求
- */
- POST_GET,
-
- /**
- * 新增(或者说插入)数据
- */
- POST,
-
- /**
- * 修改数据,只修改传入字段对应的值
- */
- PUT,
-
- /**
- * 删除数据
- */
- DELETE,
-
- /**
- * 检查,默认是非空检查,返回数据总数
- */
- HEAD
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/StringUtil.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/StringUtil.java
deleted file mode 100644
index b86924040..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/StringUtil.java
+++ /dev/null
@@ -1,664 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import java.io.File;
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**通用字符串(String)相关类,为null时返回""
- * @author Lemon
- * @use StringUtil.
- */
-public class StringUtil {
-
- public StringUtil() {
- }
-
- public static final String UTF_8 = "utf-8";
-
- public static final String EMPTY = "无";
- public static final String UNKNOWN = "未知";
- public static final String UNLIMITED = "不限";
-
- public static final String I = "我";
- public static final String YOU = "你";
- public static final String HE = "他";
- public static final String SHE = "她";
- public static final String IT = "它";
-
- public static final String MALE = "男";
- public static final String FEMALE = "女";
-
- public static final String TODO = "未完成";
- public static final String DONE = "已完成";
-
- public static final String FAIL = "失败";
- public static final String SUCCESS = "成功";
-
- public static final String SUNDAY = "日";
- public static final String MONDAY = "一";
- public static final String TUESDAY = "二";
- public static final String WEDNESDAY = "三";
- public static final String THURSDAY = "四";
- public static final String FRIDAY = "五";
- public static final String SATURDAY = "六";
-
- public static final String YUAN = "元";
-
-
- private static String currentString = "";
- /**获取刚传入处理后的string
- * @must 上个影响currentString的方法 和 这个方法都应该在同一线程中,否则返回值可能不对
- * @return
- */
- public static String getCurrentString() {
- return currentString == null ? "" : currentString;
- }
-
- //获取string,为null时返回"" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取string,为null则返回""
- * @param object
- * @return
- */
- public static String getString(Object object) {
- return object == null ? "" : getString(String.valueOf(object));
- }
- /**获取string,为null则返回""
- * @param cs
- * @return
- */
- public static String getString(CharSequence cs) {
- return cs == null ? "" : getString(cs.toString());
- }
- /**获取string,为null则返回""
- * @param s
- * @return
- */
- public static String getString(String s) {
- return s == null ? "" : s;
- }
- /**获取string,为null则返回""
- * @param array
- * @return
- */
- public static String getString(String[] array) {
- return getString(array, null);
- }
- /**获取string,为null则返回""
- * @param array
- * @param split
- * @return
- */
- public static String getString(String[] array, String split) {
- String s = "";
- if (array != null) {
- if (split == null) {
- split = ",";
- }
- for (int i = 0; i < array.length; i++) {
- s += ((i > 0 ? split : "") + array[i]);
- }
- }
- return getString(s);
- }
-
- //获取string,为null时返回"" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //获取去掉前后空格后的string<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取去掉前后空格后的string,为null则返回""
- * @param object
- * @return
- */
- public static String getTrimedString(Object object) {
- return getTrimedString(getString(object));
- }
- /**获取去掉前后空格后的string,为null则返回""
- * @param cs
- * @return
- */
- public static String getTrimedString(CharSequence cs) {
- return getTrimedString(getString(cs));
- }
- /**获取去掉前后空格后的string,为null则返回""
- * @param s
- * @return
- */
- public static String getTrimedString(String s) {
- return getString(s).trim();
- }
-
- //获取去掉前后空格后的string>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //获取去掉所有空格后的string <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取去掉所有空格后的string,为null则返回""
- * @param object
- * @return
- */
- public static String getNoBlankString(Object object) {
- return getNoBlankString(getString(object));
- }
- /**获取去掉所有空格后的string,为null则返回""
- * @param cs
- * @return
- */
- public static String getNoBlankString(CharSequence cs) {
- return getNoBlankString(getString(cs));
- }
- /**获取去掉所有空格后的string,为null则返回""
- * @param s
- * @return
- */
- public static String getNoBlankString(String s) {
- return getString(s).replaceAll("\\s", "");
- }
-
- //获取去掉所有空格后的string >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //获取string的长度<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取string的长度,为null则返回0
- * @param object
- * @param trim
- * @return
- */
- public static int getLength(Object object, boolean trim) {
- return getLength(getString(object), trim);
- }
- /**获取string的长度,为null则返回0
- * @param cs
- * @param trim
- * @return
- */
- public static int getLength(CharSequence cs, boolean trim) {
- return getLength(getString(cs), trim);
- }
- /**获取string的长度,为null则返回0
- * @param s
- * @param trim
- * @return
- */
- public static int getLength(String s, boolean trim) {
- s = trim ? getTrimedString(s) : s;
- return getString(s).length();
- }
-
- //获取string的长度>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //判断字符是否非空 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**判断字符是否非空
- * @param object
- * @param trim
- * @return
- */
- public static boolean isNotEmpty(Object object, boolean trim) {
- return isNotEmpty(getString(object), trim);
- }
- /**判断字符是否非空
- * @param cs
- * @param trim
- * @return
- */
- public static boolean isNotEmpty(CharSequence cs, boolean trim) {
- return isNotEmpty(getString(cs), trim);
- }
- /**判断字符是否非空
- * @param s
- * @param trim
- * @return
- */
- public static boolean isNotEmpty(String s, boolean trim) {
- // Log.i(TAG, "getTrimedString s = " + s);
- if (s == null) {
- return false;
- }
- if (trim) {
- s = s.trim();
- }
- if (s.length() <= 0) {
- return false;
- }
-
- currentString = s;
-
- return true;
- }
-
- //判断字符是否非空 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //判断字符类型 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final Pattern alphaPattern;
- public static final Pattern bigAlphaPattern;
- public static final Pattern namePattern;
- public static final Pattern smallAlphaPattern;
- static {
- alphaPattern = Pattern.compile("[a-zA-Z]");
- bigAlphaPattern = Pattern.compile("[A-Z]");
- namePattern = Pattern.compile("^[0-9a-zA-Z_]+$");//已用55个中英字符测试通过
- smallAlphaPattern = Pattern.compile("[a-z]");
- }
-
- //判断手机格式是否正确
- public static boolean isPhone(String phone) {
- if (isNotEmpty(phone, true) == false) {
- return false;
- }
-
- Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0-2,5-9])|(17[0-9]))\\d{8}$");
-
- currentString = phone;
-
- return p.matcher(phone).matches();
- }
- //判断email格式是否正确
- public static boolean isEmail(String email) {
- if (isNotEmpty(email, true) == false) {
- return false;
- }
-
- String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
- Pattern p = Pattern.compile(str);
-
- currentString = email;
-
- return p.matcher(email).matches();
- }
-
- /**判断是否全是数字
- * @param s
- * @return
- */
- public static boolean isNumer(String s) {
- if (isNotEmpty(s, true) == false) {
- return false;
- }
-
- Pattern pattern = Pattern.compile("[0-9]");
- Matcher matcher;
- for (int i = 0; i < s.length(); i++) {
- matcher = pattern.matcher(s.substring(i, i+1));
- if(! matcher.matches()){
- return false;
- }
- }
-
- currentString = s;
-
- return true;
- }
- /**判断是否全是字母
- * @param s
- * @return
- */
- public static boolean isAlpha(String s) {
- if (s == null) {
- System.out.println("isNumberOrAlpha inputed == null >> return false;");
- return false;
- }
- Pattern pAlpha = Pattern.compile("[a-zA-Z]");
- Matcher mAlpha;
- for (int i = 0; i < s.length(); i++) {
- mAlpha = pAlpha.matcher(s.substring(i, i+1));
- if(! mAlpha.matches()){
- return false;
- }
- }
-
- currentString = s;
- return true;
- }
- /**判断是否全是数字或字母
- * @param s
- * @return
- */
- public static boolean isNumberOrAlpha(String s) {
- return isNumer(s) || isAlpha(s);
- }
-
- /**判断字符类型是否是身份证号
- * @param idCard
- * @return
- */
- public static boolean isIDCard(String idCard) {
- if (isNumberOrAlpha(idCard) == false) {
- return false;
- }
- idCard = getString(idCard);
- if (idCard.length() == 15) {
- System.out.println("isIDCard idCard.length() == 15 old IDCard");
- currentString = idCard;
- return true;
- }
- if (idCard.length() == 18) {
- currentString = idCard;
- return true;
- }
-
- return false;
- }
-
- public static final String HTTP = "http";
- public static final String URL_PREFIX = "http://";
- public static final String URL_PREFIXs = "https://";
- public static final String URL_STAFFIX = URL_PREFIX;
- public static final String URL_STAFFIXs = URL_PREFIXs;
- /**判断字符类型是否是网址
- * @param url
- * @return
- */
- public static boolean isUrl(String url) {
- if (isNotEmpty(url, true) == false) {
- return false;
- } else if (! url.startsWith(URL_PREFIX) && ! url.startsWith(URL_PREFIXs)) {
- return false;
- }
-
- currentString = url;
- return true;
- }
-
- public static final String FILE_PATH_PREFIX = "file://";
- /**判断文件路径是否存在
- * @param path
- * @return
- */
- public static boolean isFilePathExist(String path) {
- return StringUtil.isFilePath(path) && new File(path).exists();
- }
-
- public static final String SEPARATOR = "/";
- /**判断是否为路径
- * @param path
- * @return
- */
- public static boolean isPath(String path) {
- return StringUtil.isNotEmpty(path, true) && path.contains(SEPARATOR)
- && path.contains(SEPARATOR + SEPARATOR) == false && path.endsWith(SEPARATOR) == false;
- }
-
- /**分割路径
- * @param path
- * @return
- */
- public static String[] splitPath(String path) {
- return isPath(path) ? split(path, SEPARATOR) : new String[] {path};
- }
- /**将s分割成String[]
- * @param s
- * @return
- */
- public static String[] split(String s) {
- return split(s, null);
- }
- /**将s用split分割成String[]
- * @param s
- * @param split
- * @return
- */
- public static String[] split(String s, String split) {
- s = getString(s);
- if (s.isEmpty()) {
- return null;
- }
- if (isNotEmpty(split, false) == false) {
- split = ",";
- }
- while (s.startsWith(split)) {
- s = s.substring(split.length());
- }
- while (s.endsWith(split)) {
- s = s.substring(0, s.length() - split.length());
- }
- return s.contains(split) ? s.split(split) : new String[]{s};
- }
-
-
- /**判断字符类型是否是路径
- * @param path
- * @return
- */
- public static boolean isFilePath(String path) {
- if (isNotEmpty(path, true) == false) {
- return false;
- }
-
- if (! path.contains(".") || path.endsWith(".")) {
- return false;
- }
-
- currentString = path;
-
- return true;
- }
-
- //判断字符类型 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //提取特殊字符<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**去掉string内所有非数字类型字符
- * @param object
- * @return
- */
- public static String getNumber(Object object) {
- return getNumber(getString(object));
- }
- /**去掉string内所有非数字类型字符
- * @param cs
- * @return
- */
- public static String getNumber(CharSequence cs) {
- return getNumber(getString(cs));
- }
- /**去掉string内所有非数字类型字符
- * @param s
- * @return
- */
- public static String getNumber(String s) {
- return getNumber(s, false);
- }
- /**去掉string内所有非数字类型字符
- * @param s
- * @param onlyStart 中间有非数字时只获取前面的数字
- * @return
- */
- public static String getNumber(String s, boolean onlyStart) {
- if (isNotEmpty(s, true) == false) {
- return "";
- }
-
- String numberString = "";
- String single;
- for (int i = 0; i < s.length(); i++) {
- single = s.substring(i, i + 1);
- if (isNumer(single)) {
- numberString += single;
- } else {
- if (onlyStart) {
- return numberString;
- }
- }
- }
-
- return numberString;
- }
-
- //提取特殊字符>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //校正(自动补全等)字符串<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取网址,自动补全
- * @param url
- * @return
- */
- public static String getCorrectUrl(String url) {
- System.out.println("getCorrectUrl : \n" + url);
- if (isNotEmpty(url, true) == false) {
- return "";
- }
-
- // if (! url.endsWith("/") && ! url.endsWith(".html")) {
- // url = url + "/";
- // }
-
- if (isUrl(url) == false) {
- return URL_PREFIX + url;
- }
- return url;
- }
-
- /**获取去掉所有 空格 、"-" 、"+86" 后的phone
- * @param phone
- * @return
- */
- public static String getCorrectPhone(String phone) {
- if (isNotEmpty(phone, true) == false) {
- return "";
- }
-
- phone = getNoBlankString(phone);
- phone = phone.replaceAll("-", "");
- if (phone.startsWith("+86")) {
- phone = phone.substring(3);
- }
- return phone;
- }
-
-
- /**获取邮箱,自动补全
- * @param email
- * @return
- */
- public static String getCorrectEmail(String email) {
- if (isNotEmpty(email, true) == false) {
- return "";
- }
-
- email = getNoBlankString(email);
- if (isEmail(email) == false && ! email.endsWith(".com")) {
- email += ".com";
- }
-
- return email;
- }
-
-
- public static final int PRICE_FORMAT_DEFAULT = 0;
- public static final int PRICE_FORMAT_PREFIX = 1;
- public static final int PRICE_FORMAT_SUFFIX = 2;
- public static final int PRICE_FORMAT_PREFIX_WITH_BLANK = 3;
- public static final int PRICE_FORMAT_SUFFIX_WITH_BLANK = 4;
- public static final String[] PRICE_FORMATS = {
- "", "¥", "元", "¥ ", " 元"
- };
-
- /**获取价格,保留两位小数
- * @param price
- * @return
- */
- public static String getPrice(String price) {
- return getPrice(price, PRICE_FORMAT_DEFAULT);
- }
- /**获取价格,保留两位小数
- * @param price
- * @param formatType 添加单位(元)
- * @return
- */
- public static String getPrice(String price, int formatType) {
- if (isNotEmpty(price, true) == false) {
- return getPrice(0, formatType);
- }
-
- //单独写到getCorrectPrice? <<<<<<<<<<<<<<<<<<<<<<
- String correctPrice = "";
- String s;
- for (int i = 0; i < price.length(); i++) {
- s = price.substring(i, i + 1);
- if (".".equals(s) || isNumer(s)) {
- correctPrice += s;
- }
- }
- //单独写到getCorrectPrice? >>>>>>>>>>>>>>>>>>>>>>
-
- System.out.println("getPrice <<<<<<<<<<<<<<<<<< correctPrice = " + correctPrice);
- if (correctPrice.contains(".")) {
- // if (correctPrice.startsWith(".")) {
- // correctPrice = 0 + correctPrice;
- // }
- if (correctPrice.endsWith(".")) {
- correctPrice = correctPrice.replaceAll(".", "");
- }
- }
-
- System.out.println("getPrice correctPrice = " + correctPrice + " >>>>>>>>>>>>>>>>");
- return isNotEmpty(correctPrice, true) ? getPrice(new BigDecimal(0 + correctPrice), formatType) : getPrice(0, formatType);
- }
- /**获取价格,保留两位小数
- * @param price
- * @return
- */
- public static String getPrice(BigDecimal price) {
- return getPrice(price, PRICE_FORMAT_DEFAULT);
- }
- /**获取价格,保留两位小数
- * @param price
- * @return
- */
- public static String getPrice(double price) {
- return getPrice(price, PRICE_FORMAT_DEFAULT);
- }
- /**获取价格,保留两位小数
- * @param price
- * @param formatType 添加单位(元)
- * @return
- */
- public static String getPrice(BigDecimal price, int formatType) {
- return getPrice(price == null ? 0 : price.doubleValue(), formatType);
- }
- /**获取价格,保留两位小数
- * @param price
- * @param formatType 添加单位(元)
- * @return
- */
- public static String getPrice(double price, int formatType) {
- String s = new DecimalFormat("#########0.00").format(price);
- switch (formatType) {
- case PRICE_FORMAT_PREFIX:
- return PRICE_FORMATS[PRICE_FORMAT_PREFIX] + s;
- case PRICE_FORMAT_SUFFIX:
- return s + PRICE_FORMATS[PRICE_FORMAT_SUFFIX];
- case PRICE_FORMAT_PREFIX_WITH_BLANK:
- return PRICE_FORMATS[PRICE_FORMAT_PREFIX_WITH_BLANK] + s;
- case PRICE_FORMAT_SUFFIX_WITH_BLANK:
- return s + PRICE_FORMATS[PRICE_FORMAT_SUFFIX_WITH_BLANK];
- default:
- return s;
- }
- }
-
- //校正(自动补全等)字符串>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/client/package-info.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/client/package-info.java
deleted file mode 100644
index 2d815a9dd..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/client/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * files for client projects
- */
-/**
- * @author Lemon
- *
- */
-package zuo.biao.apijson.client;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/package-info.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/package-info.java
deleted file mode 100644
index 707b9d11a..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/main/java/zuo/biao/apijson/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * the same files for server and client projects
- */
-/**
- * @author Lemon
- *
- */
-package zuo.biao.apijson;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/test/java/zuo/biao/apijson/client/ExampleUnitTest.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/test/java/zuo/biao/apijson/client/ExampleUnitTest.java
deleted file mode 100644
index e02ebdc79..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/APIJSONLibrary/src/test/java/zuo/biao/apijson/client/ExampleUnitTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package zuo.biao.apijson.client;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * To work on unit tests, switch the Test Artifact in the Build Variants view.
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/.gitignore b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/.gitignore
deleted file mode 100644
index 796b96d1c..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/build.gradle b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/build.gradle
deleted file mode 100644
index 63d4a6c52..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/build.gradle
+++ /dev/null
@@ -1,29 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 23
- buildToolsVersion '23.0.2'
- defaultConfig {
- applicationId "apijson.demo"
- minSdkVersion 15
- targetSdkVersion 22
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
- productFlavors {
- }
-}
-
-dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- testCompile 'junit:junit:4.12'
- compile project(':APIJSONLibrary')
- compile files('libs/okhttp-2.1.0.jar')
- compile files('libs/okio-1.0.0.jar')
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/libs/okhttp-2.1.0.jar b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/libs/okhttp-2.1.0.jar
deleted file mode 100644
index 837defb9d..000000000
Binary files a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/libs/okhttp-2.1.0.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/libs/okio-1.0.0.jar b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/libs/okio-1.0.0.jar
deleted file mode 100644
index 909cfa98d..000000000
Binary files a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/libs/okio-1.0.0.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/proguard-rules.pro b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/proguard-rules.pro
deleted file mode 100644
index 90cb5eb39..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/proguard-rules.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Users/Tommy/Library/Android/sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/androidTest/java/apijson/demo/ApplicationTest.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/androidTest/java/apijson/demo/ApplicationTest.java
deleted file mode 100644
index 9a2df41db..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/androidTest/java/apijson/demo/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package apijson.demo;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * Testing Fundamentals
- */
-public class ApplicationTest extends ApplicationTestCase {
- public ApplicationTest() {
- super(Application.class);
- }
-}
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/AndroidManifest.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/AndroidManifest.xml
deleted file mode 100644
index 972be9a9f..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/HttpManager.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/HttpManager.java
deleted file mode 100644
index 79bee91f3..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/HttpManager.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo;
-
-import static zuo.biao.apijson.StringUtil.UTF_8;
-
-import java.io.IOException;
-import java.net.CookieHandler;
-import java.net.URI;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import zuo.biao.apijson.StringUtil;
-import android.content.Context;
-import android.os.AsyncTask;
-import android.text.TextUtils;
-import android.util.Log;
-import apijson.demo.application.DemoApplication;
-
-import com.squareup.okhttp.MediaType;
-import com.squareup.okhttp.OkHttpClient;
-import com.squareup.okhttp.Request;
-import com.squareup.okhttp.RequestBody;
-import com.squareup.okhttp.Response;
-
-/**HTTP请求管理类
- * @author Lemon
- * @use HttpManager.getInstance().get(...)或HttpManager.getInstance().post(...) > 在回调方法onHttpRequestSuccess和onHttpRequestError处理HTTP请求结果
- * @must 解决getToken,getResponseCode,getResponseData中的TODO
- */
-public class HttpManager {
- private static final String TAG = "HttpManager";
-
- /**网络请求回调接口
- */
- public interface OnHttpResponseListener {
- /**
- * @param requestCode 请求码,自定义,在发起请求的类中可以用requestCode来区分各个请求
- * @param resultJson 服务器返回的Json串
- * @param e 异常
- */
- void onHttpResponse(int requestCode, String resultJson, Exception e);
- }
-
-
-
- private Context context;
- private static HttpManager instance;// 单例
- private HttpManager(Context context) {
- this.context = context;
-
- }
-
- public synchronized static HttpManager getInstance() {
- if (instance == null) {
- instance = new HttpManager(DemoApplication.getInstance());
- }
- return instance;
- }
-
-
-
- /**
- * 列表首页页码。有些服务器设置为1,即列表页码从1开始
- */
- public static final int PAGE_NUM_0 = 0;
-
- public static final String KEY_TOKEN = "token";
- public static final String KEY_COOKIE = "cookie";
-
-
- /**GET请求
- * @param paramList 请求参数列表,(可以一个键对应多个值)
- * @param url 接口url
- * @param requestCode
- * 请求码,类似onActivityResult中请求码,当同一activity中以实现接口方式发起多个网络请求时,请求结束后都会回调
- * {@link OnHttpResponseListener#onHttpResponse(int, String, Exception)}
- * 在发起请求的类中可以用requestCode来区分各个请求
- * @param listener
- */
- public void get(final String url_, final String request, final OnHttpResponseListener listener) {
- Log.d(TAG, "get url_ = " + url_ + "; request = " + request + " >>>");
- new AsyncTask() {
-
- String result;
- @Override
- protected Exception doInBackground(Void... params) {
- try {
- String url = StringUtil.getNoBlankString(url_)
- + URLEncoder.encode(StringUtil.getNoBlankString(request), UTF_8);
- StringBuffer sb = new StringBuffer();
- sb.append(url);
-
- OkHttpClient client = getHttpClient(url);
- if (client == null) {
- return new Exception(TAG + ".get AsyncTask.doInBackground client == null >> return;");
- }
-
- result = getResponseJson(client, new Request.Builder()
- .addHeader(KEY_TOKEN, getToken(url))
- .url(http://github.com/sb.toString()).build());
- } catch (Exception e) {
- Log.e(TAG, "get AsyncTask.doInBackground try { result = getResponseJson(..." +
- "} catch (Exception e) {\n" + e.getMessage());
- return e;
- }
-
- return null;
- }
-
- @Override
- protected void onPostExecute(Exception exception) {
- super.onPostExecute(exception);
- listener.onHttpResponse(0, result, exception);
- }
-
- }.execute();
-
- }
-
- public static final MediaType TYPE_JSON =MediaType.parse("application/json; charset=utf-8");
-
- /**POST请求
- * @param paramList 请求参数列表,(可以一个键对应多个值)
- * @param url 接口url
- * @param requestCode
- * 请求码,类似onActivityResult中请求码,当同一activity中以实现接口方式发起多个网络请求时,请求结束后都会回调
- * {@link OnHttpResponseListener#onHttpResponse(int, String, Exception)}
- * 在发起请求的类中可以用requestCode来区分各个请求
- * @param listener
- */
- public void post(final String url_, final String request, final OnHttpResponseListener listener) {
-
- new AsyncTask() {
-
- String result;
- @Override
- protected Exception doInBackground(Void... params) {
-
- try {
- String url = StringUtil.getNoBlankString(url_);
-
- OkHttpClient client = getHttpClient(url);
- if (client == null) {
- return new Exception(TAG + ".post AsyncTask.doInBackground client == null >> return;");
- }
-
- RequestBody requestBody = RequestBody.create(TYPE_JSON, request);
-
- result = getResponseJson(client, new Request.Builder()
- .addHeader(KEY_TOKEN, getToken(url)).url(http://github.com/StringUtil.getNoBlankString(url))
- .post(requestBody).build());
- } catch (Exception e) {
- Log.e(TAG, "post AsyncTask.doInBackground try { result = getResponseJson(..." +
- "} catch (Exception e) {\n" + e.getMessage());
- return e;
- }
-
- return null;
- }
-
- @Override
- protected void onPostExecute(Exception exception) {
- super.onPostExecute(exception);
- listener.onHttpResponse(0, result, exception);
- }
-
- }.execute();
- }
-
-
- //httpGet/httpPost 内调用方法 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**
- * @param url
- * @return
- */
- private OkHttpClient getHttpClient(String url) {
- Log.i(TAG, "getHttpClient url = " + url);
- if (StringUtil.isNotEmpty(url, true) == false) {
- Log.e(TAG, "getHttpClient StringUtil.isNotEmpty(url, true) == false >> return null;");
- return null;
- }
-
- OkHttpClient client = new OkHttpClient();
- client.setCookieHandler(new HttpHead());
- client.setConnectTimeout(15, TimeUnit.SECONDS);
- client.setWriteTimeout(10, TimeUnit.SECONDS);
- client.setReadTimeout(10, TimeUnit.SECONDS);
-
- return client;
- }
-
- /**
- * @param paramList
- * @must demo_***改为服务器设定值
- * @return
- */
- public String getToken(String tag) {
- return context.getSharedPreferences(KEY_TOKEN, Context.MODE_PRIVATE).getString(KEY_TOKEN + tag, "");
- }
- /**
- * @param tag
- * @param value
- */
- public void saveToken(String tag, String value) {
- context.getSharedPreferences(KEY_TOKEN, Context.MODE_PRIVATE)
- .edit()
- .remove(KEY_TOKEN + tag)
- .putString(KEY_TOKEN + tag, value)
- .commit();
- }
-
-
- /**
- * @return
- */
- public String getCookie() {
- return context.getSharedPreferences(KEY_COOKIE, Context.MODE_PRIVATE).getString(KEY_COOKIE, "");
- }
- /**
- * @param value
- */
- public void saveCookie(String value) {
- context.getSharedPreferences(KEY_COOKIE, Context.MODE_PRIVATE)
- .edit()
- .remove(KEY_COOKIE)
- .putString(KEY_COOKIE, value)
- .commit();
- }
-
-
- /**
- * @param client
- * @param request
- * @return
- * @throws Exception
- */
- private String getResponseJson(OkHttpClient client, Request request) throws Exception {
- if (client == null || request == null) {
- Log.e(TAG, "getResponseJson client == null || request == null >> return null;");
- return null;
- }
- Response response = client.newCall(request).execute();
- return response.isSuccessful() ? response.body().string() : null;
- }
-
- /**从object中获取key对应的值
- * *获取如果T是基本类型容易崩溃,所以需要try-catch
- * @param json
- * @param key
- * @return
- * @throws JSONException
- */
- public T getValue(String json, String key) throws JSONException {
- return getValue(new JSONObject(json), key);
- }
- /**从object中获取key对应的值
- * *获取如果T是基本类型容易崩溃,所以需要try-catch
- * @param object
- * @param key
- * @return
- * @throws JSONException
- */
- @SuppressWarnings("unchecked")
- public T getValue(JSONObject object, String key) throws JSONException {
- return (T) object.get(key);
- }
-
- //httpGet/httpPost 内调用方法 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
- /**http请求头
- */
- public class HttpHead extends CookieHandler {
- public HttpHead() {
- }
-
- @Override
- public Map> get(URI uri, Map> requestHeaders) throws IOException {
- String cookie = getCookie();
- Map> map = new HashMap>();
- map.putAll(requestHeaders);
- if (!TextUtils.isEmpty(cookie)) {
- List cList = new ArrayList();
- cList.add(cookie);
- map.put("Cookie", cList);
- }
- return map;
- }
-
- @Override
- public void put(URI uri, Map> responseHeaders) throws IOException {
- List list = responseHeaders.get("Set-Cookie");
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- String cookie = list.get(i);
- if (cookie.startsWith("JSESSIONID")) {
- saveCookie(list.get(i));
- break;
- }
- }
- }
- }
-
- }
-
-
-
-
-}
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/RequestUtil.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/RequestUtil.java
deleted file mode 100644
index bd596728a..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/RequestUtil.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import zuo.biao.apijson.JSONObject;
-import zuo.biao.apijson.JSONRequest;
-import android.content.Context;
-import apijson.demo.application.DemoApplication;
-import apijson.demo.model.Comment;
-import apijson.demo.model.Moment;
-import apijson.demo.model.User;
-import apijson.demo.model.Wallet;
-
-/**请求工具类
- * 设置encode参数只为方便展示,实际使用时并不需要
- * @author Lemon
- */
-public class RequestUtil {
-
- private static Context context;
- static {
- context = DemoApplication.getInstance();
- }
-
- private static final long DEFAULT_MOMENT_ID = 15;
- private static final long DEFAULT_USER_ID = 38710;
-
-
-
- public static JSONObject newPostRequest(boolean encode) {
- Moment data = new Moment();
- data.setUserId(DEFAULT_USER_ID);
- data.setContent(context.getString(R.string.apijson_slogan));
- List list = new ArrayList();
- list.add("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000");
- list.add("http://common.cnblogs.com/images/icon_weibo_24.png");
- data.setPictureList(list);
- return new JSONRequest(data, encode).setTag(Moment.class.getSimpleName());
- }
-
- public static JSONObject newPutRequest(long id, boolean encode) {
- Moment data = new Moment(id <= 0 ? DEFAULT_MOMENT_ID : id);
- // data.setContent(context.getString(R.string.apijson_info));//一般可用这种方式,encode是为了展示方便
- List list = new ArrayList<>();
- list.add((long) 10000);
- list.add((long) 10001);
- JSONObject momentObject = new JSONObject(data, encode);
- momentObject.put("praiseUserIdList+", list, encode);
- momentObject.put("content", context.getString(R.string.apijson_info), encode);
- return new JSONRequest(Moment.class.getSimpleName(), momentObject, encode).setTag(Moment.class.getSimpleName());
- }
-
- public static JSONObject newDeleteRequest(long id, boolean encode) {
- return new JSONRequest(new Moment(id <= 0 ? 10000 : id), encode).setTag(Moment.class.getSimpleName());
- }
-
-
-
-
- public static JSONObject newSingleRequest(long id, boolean encode) {
- return new JSONRequest(new Moment(id <= 0 ? DEFAULT_MOMENT_ID : id), encode);
- }
-
- public static JSONObject newColumnsRequest(long id, boolean encode) {
- JSONObject object = new JSONObject(new Moment(id <= 0 ? DEFAULT_MOMENT_ID : id), encode);
- object.setColumns("id,userId,content");
- return new JSONRequest(Moment.class.getSimpleName(), object, encode);
- }
-
- public static JSONObject newRelyRequest(long id, boolean encode) {
- JSONRequest request = new JSONRequest();
- request.put(new Moment(id <= 0 ? DEFAULT_MOMENT_ID : id), encode);
- request.put(User.class.getSimpleName(), new JSONRequest("id@", "Moment/userId", encode));
- return request;
- }
-
- public static JSONObject newArrayRequest(boolean encode) {
- JSONRequest dataObject = new JSONRequest();
- dataObject.put("name$", "%o%", encode);
- JSONRequest request = new JSONRequest(User.class.getSimpleName(), dataObject, encode);
- return request.toArray(5, 1, User.class.getSimpleName(), encode);
- }
-
- public static JSONObject newComplexRequest(boolean encode) {
- JSONRequest request = new JSONRequest();
-
- List idList = new ArrayList();
- idList.add(DEFAULT_USER_ID);
- idList.add((long) 93793);
- request.put(Moment.class.getSimpleName(), new JSONRequest("userId{}", idList, encode), encode);
-
- request.put(User.class.getSimpleName(), new JSONRequest("id@", "/Moment/userId", encode), encode);
-
- request.add(new JSONRequest(Comment.class.getSimpleName()
- , new JSONRequest("workId@", "[]/Moment/id", encode), encode).
- toArray(3, 0, Comment.class.getSimpleName()), encode);
-
- return request.toArray(3, 0, encode);
- }
-
- public static JSONObject newAccessErrorRequest(boolean encode) {
- return new JSONRequest(new Wallet().setUserId(DEFAULT_USER_ID), encode)
- .setTag(Wallet.class.getSimpleName());
- }
-
- public static JSONObject newAccessPermittedRequest(boolean encode) {
- JSONRequest request = new JSONRequest();
- request.put(new Wallet().setUserId(DEFAULT_USER_ID), encode);
- request.put("currentUserId", DEFAULT_USER_ID, encode);
- request.put("loginPassword", "apijson", encode);
- return request.setTag(Wallet.class.getSimpleName());
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/StringUtil.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/StringUtil.java
deleted file mode 100644
index ef7b29daa..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/StringUtil.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package apijson.demo;
-
-import android.widget.TextView;
-
-/**String工具类
- * @author Lemon
- */
-public class StringUtil extends zuo.biao.apijson.StringUtil {
-
- public static String getString(TextView tv) {
- if (tv == null || tv.getText() == null) {
- return "";
- }
- return getString(tv.getText().toString());
- }
- public static String getTrimedString(TextView tv) {
- return getTrimedString(getString(tv));
- }
- public static String getNoBlankString(TextView tv) {
- return getNoBlankString(getString(tv));
- }
-
- public static boolean isNotEmpty(TextView tv, boolean trim) {
- return isNotEmpty(getString(tv), trim);
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/application/DemoApplication.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/application/DemoApplication.java
deleted file mode 100644
index 863bfb736..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/application/DemoApplication.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.application;
-
-import android.app.Application;
-import android.util.Log;
-import apijson.demo.R;
-
-/**Application
- * @author Lemon
- */
-public class DemoApplication extends Application {
- private static final String TAG = "DemoApplication";
-
-
- private static Application instance;
- public static Application getInstance() {
- return instance;
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
- instance = this;
- Log.d(TAG, "项目启动 >>>>>>>>>>>>>>>>>>>> \n\n");
-
- }
-
-
- /**获取应用名
- * @return
- */
- public String getAppName() {
- return getResources().getString(R.string.app_name);
- }
- /**获取应用版本名(显示给用户看的)
- * @return
- */
- public String getAppVersion() {
- return getResources().getString(R.string.app_version);
- }
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/application/package-info.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/application/package-info.java
deleted file mode 100644
index cdd3651f8..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/application/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * application所在包
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo.application;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/BaseModel.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/BaseModel.java
deleted file mode 100644
index d634d074a..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/BaseModel.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.model;
-
-import java.io.Serializable;
-
-/**基础model,继承它可减少部分代码
- * @author Lemon
- * @use extends BaseModel
- */
-public abstract class BaseModel implements Serializable {
- private static final long serialVersionUID = 7560533944342381808L;
-
- public Long id;
-
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/Comment.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/Comment.java
deleted file mode 100644
index 01611b726..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/Comment.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.model;
-
-/**评论类
- * @author Lemon
- */
-public class Comment extends BaseModel {
- private static final long serialVersionUID = -1011007127735372824L;
-
- public Long workId;
- public Long parentId;
- public Long userId;
- public Long targetUserId;
- public String userName;
- public String targetUserName;
- public String content;
- public Comment() {
- super();
- }
- public Comment(Long id, String content) {
- this();
- this.id = id;
- this.content = content;
- }
-
- public Long getWorkId() {
- return workId;
- }
- public void setWorkId(Long workId) {
- this.workId = workId;
- }
- public Long getParentId() {
- return parentId;
- }
- public void setParentId(Long parentId) {
- this.parentId = parentId;
- }
- public Long getUserId() {
- return userId;
- }
- public void setUserId(Long userId) {
- this.userId = userId;
- }
- public Long getTargetUserId() {
- return targetUserId;
- }
- public void setTargetUserId(Long targetUserId) {
- this.targetUserId = targetUserId;
- }
- public String getUserName() {
- return userName;
- }
- public void setUserName(String userName) {
- this.userName = userName;
- }
- public String getTargetUserName() {
- return targetUserName;
- }
- public void setTargetUserName(String targetUserName) {
- this.targetUserName = targetUserName;
- }
- public String getContent() {
- return content;
- }
- public void setContent(String content) {
- this.content = content;
- }
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/Moment.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/Moment.java
deleted file mode 100644
index dd89e02ae..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/Moment.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.model;
-
-import java.util.List;
-
-/**作品类
- * @author Lemon
- */
-public class Moment extends BaseModel {
- private static final long serialVersionUID = -7437225320551780084L;
-
- private Long userId;
- private String content;
- private String picture;
- private List pictureList;
- private List praiseUserIdList;
- private List commentIdList;
-
- public Moment() {
- super();
- }
- public Moment(long id) {
- this();
- setId(id);
- }
-
- public Long getUserId() {
- return userId;
- }
- public Moment setUserId(Long userId) {
- this.userId = userId;
- return this;
- }
- public String getContent() {
- return content;
- }
- public Moment setContent(String content) {
- this.content = content;
- return this;
- }
- public String getPicture() {
- return picture;
- }
- public Moment setPicture(String picture) {
- this.picture = picture;
- return this;
- }
- public List getPictureList() {
- return pictureList;
- }
- public Moment setPictureList(List pictureList) {
- this.pictureList = pictureList;
- return this;
- }
- public List getPraiseUserIdList() {
- return praiseUserIdList;
- }
- public Moment setPraiseUserIdList(List praiseUserIdList) {
- this.praiseUserIdList = praiseUserIdList;
- return this;
- }
- public List getCommentIdList() {
- return commentIdList;
- }
- public Moment setCommentIdList(List commentIdList) {
- this.commentIdList = commentIdList;
- return this;
- }
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/User.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/User.java
deleted file mode 100644
index 6a7a23f51..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/User.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.model;
-
-import java.util.List;
-
-/**用户类
- * @author Lemon
- */
-public class User extends BaseModel {
- private static final long serialVersionUID = -1635551656020732611L;
-
- public Integer sex;
- public String head;
- public String name;
- public String phone;
- public List pictureList;
-
- /**默认构造方法,JSON等解析时必须要有
- */
- public User() {
- super();
- }
- public User(long id) {
- this();
- this.id = id;
- }
- public User(long id, String name) {
- this(id);
- this.name = name;
- }
-
- public Integer getSex() {
- return sex;
- }
- public User setSex(Integer sex) {
- this.sex = sex;
- return this;
- }
- public String getHead() {
- return head;
- }
- public void setHead(String head) {
- this.head = head;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getPhone() {
- return phone;
- }
- public void setPhone(String phone) {
- this.phone = phone;
- }
- public List getPictureList() {
- return pictureList;
- }
- public void setPictureList(List pictureList) {
- this.pictureList = pictureList;
- }
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/Wallet.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/Wallet.java
deleted file mode 100644
index 43eadb2b5..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/Wallet.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.model;
-
-import java.math.BigDecimal;
-
-/**钱包类
- * @author Lemon
- */
-public class Wallet extends BaseModel {
- private static final long serialVersionUID = 4298571449155754300L;
-
- public Long userId;
- public BigDecimal balance;
-
- /**默认构造方法,JSON等解析时必须要有
- */
- public Wallet() {
- super();
- }
- public Wallet(long id) {
- this();
- this.id = id;
- }
-
- public Wallet setUserId(Long userId) {
- this.userId = userId;
- return this;
- }
- public Long getUserId() {
- return userId;
- }
-
- public BigDecimal getBalance() {
- return balance;
- }
- public void setBalance(BigDecimal balance) {
- this.balance = balance;
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/package-info.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/package-info.java
deleted file mode 100644
index 6944f35d0..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/model/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**model类所在包
- * model对应服务器数据库里table,用于封装请求和解析结果
- * 类名称 : model == table
- * 变量(名称, 类型) : variable == column
- * @warn 在model内不用对变量使用int,boolean,char等基本类型, 用Integer,Boolean,String等对应的对象类型替代
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo.model;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/package-info.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/package-info.java
deleted file mode 100644
index 0da467eb8..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * 管理类或工具类所在包,如果类很多的话可以把它们单独分到一个或多个包
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/ui/RequestActivity.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/ui/RequestActivity.java
deleted file mode 100644
index a00bec330..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/ui/RequestActivity.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.ui;
-
-import static zuo.biao.apijson.StringUtil.UTF_8;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-
-import zuo.biao.apijson.JSON;
-import zuo.biao.apijson.JSONResponse;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnLongClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-import apijson.demo.HttpManager;
-import apijson.demo.HttpManager.OnHttpResponseListener;
-import apijson.demo.R;
-import apijson.demo.StringUtil;
-import apijson.demo.model.Moment;
-import apijson.demo.model.Wallet;
-
-import com.alibaba.fastjson.JSONObject;
-
-/**请求Activity
- * 向服务器发起请求查询或操作相应数据
- * @author Lemon
- */
-public class RequestActivity extends Activity implements OnHttpResponseListener {
- private static final String TAG = "RequestActivity";
-
-
- public static final String INTENT_ID = "INTENT_ID";
- public static final String INTENT_URL = "INTENT_URL";
- public static final String INTENT_METHOD = "INTENT_METHOD";
- public static final String INTENT_REQUEST = "INTENT_REQUEST";
-
- public static final String RESULT_ID = "RESULT_ID";
- public static final String RESULT_URL = "RESULT_URL";
-
- /**
- * @param context
- * @param id
- * @param url
- * @param method
- * @param request
- * @return
- */
- public static Intent createIntent(Context context, long id, String url, String method, JSONObject request) {
- return new Intent(context, RequestActivity.class)
- .putExtra(RequestActivity.INTENT_ID, id)
- .putExtra(RequestActivity.INTENT_URL, url)
- .putExtra(RequestActivity.INTENT_METHOD, method)
- .putExtra(RequestActivity.INTENT_REQUEST, JSON.toJSONString(request));
- }
-
-
-
-
-
- private Activity context;
- private boolean isAlive;
-
- private long id;
- private String url;
- private String method;
- private String request;
-
- private TextView tvRequestResult;
- private ProgressBar pbRequest;
- private EditText etRequestUrl;
- private Button btnRequestRequest;
-
- private String error;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.request_activity);
- context = this;
- isAlive = true;
-
-
- id = getIntent().getLongExtra(INTENT_ID, id);
- url = getIntent().getStringExtra(INTENT_URL);
- method = getIntent().getStringExtra(INTENT_METHOD);
- request = getIntent().getStringExtra(INTENT_REQUEST);
-
- method = StringUtil.getTrimedString(method);
- url = StringUtil.getCorrectUrl(url);
-
-
- tvRequestResult = (TextView) findViewById(R.id.tvRequestResult);
- pbRequest = (ProgressBar) findViewById(R.id.pbRequest);
- etRequestUrl = (EditText) findViewById(R.id.etRequestUrl);
- btnRequestRequest = (Button) findViewById(R.id.btnRequestRequest);
-
-
-
- etRequestUrl.setText(StringUtil.getString(StringUtil.isNotEmpty(url, true)
- ? url : "http://139.196.140.118:8080/"));//TODO 把这个ip地址改成你自己服务器的
- btnRequestRequest.setText(method);
-
- error = String.format(getResources().getString(R.string.request_error), StringUtil.getTrimedString(btnRequestRequest));
-
- request();
-
-
-
- btnRequestRequest.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- request();
- }
- });
- btnRequestRequest.setOnLongClickListener(new OnLongClickListener() {
-
- @Override
- public boolean onLongClick(View v) {
- openWebSite();
- return true;
- }
- });
-
- }
-
-
- /**向服务器发起请求,通过 {@link #onHttpResponse(int, String, Exception)} 返回结果
- */
- private void request() {
- setRequest();
-
- final String fullUrl = getUrl();
-
- tvRequestResult.setText("requesting...\n\n url = " + fullUrl + "\n\n request = \n" + JSON.format(request) + "\n\n\n" + error);
- pbRequest.setVisibility(View.VISIBLE);
-
- if ("get".equals(method)) {
- HttpManager.getInstance().get(fullUrl, request, this);
- } else {
- HttpManager.getInstance().post(fullUrl, request, this);
- }
- }
-
- /**用浏览器请求,只有GET请求才能正常访问
- */
- public void openWebSite() {
- if ("get".endsWith(method) == false) {
- Toast.makeText(context, R.string.browser_can_only_receive_get_response, Toast.LENGTH_LONG).show();
- }
- setRequest();
- String webSite = null;
- try {
- webSite = StringUtil.getNoBlankString(getUrl())
- + URLEncoder.encode(StringUtil.getNoBlankString(request), UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- if (StringUtil.isNotEmpty(webSite, true) == false) {
- Log.e(TAG, "openWebSite StringUtil.isNotEmpty(webSite, true) == false >> return;");
- return;
- }
-
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(webSite)));
- }
-
-
-
-
- private String getUrl() {
- return url + StringUtil.getTrimedString(btnRequestRequest) + "/";
- }
-
-
- public void setRequest() {
- url = StringUtil.getNoBlankString(etRequestUrl);
- Log.d(TAG, "setRequest url = " + url + ";\n request = " + request);
- }
-
-
-
- /*Http请求响应回调函数,返回数据在这里处理
- */
- @Override
- public void onHttpResponse(int requestCode, final String resultJson, final Exception e) {
- Log.d(TAG, "onHttpResponse resultJson = " + resultJson);
- if (e != null) {
- Log.e(TAG, "onHttpResponse e = " + e.getMessage());
- }
- JSONResponse response = new JSONResponse(resultJson);
-
- if ("post".equals(method)) {
- Moment moment = response.getObject(Moment.class);
- id = moment == null ? 0 : moment.getId();
- Log.d(TAG, "onHttpResponse post.equals(method) >> id = " + id);
-
- } else if ("put".equals(method)) {
- response.getJSONResponse(Moment.class.getSimpleName());
- Log.d(TAG, "onHttpResponse put.equals(method) >> moment = " + JSON.toJSONString(response));
-
- } else if ("delete".equals(method)) {
- response = response.getJSONResponse(Moment.class.getSimpleName());
-// if (JSONResponse.isSucceed(response)) {//delete succeed
- id = 0;//reuse default value
-// }
- Log.d(TAG, "onHttpResponse delete.equals(method) >> id = " + id
- + "; isSucceed = " + JSONResponse.isSucceed(response));
-
- } else if ("post_get".equals(method)) {
- Wallet wallet = response.getObject(Wallet.class);
- Log.d(TAG, "onHttpResponse post_get.equals(method) >> wallet = " + JSON.toJSONString(wallet));
- }
-
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- if (isAlive) {
- pbRequest.setVisibility(View.GONE);
- Toast.makeText(context, R.string.received_result, Toast.LENGTH_SHORT).show();
-
- tvRequestResult.setText(e == null || JSON.isJsonCorrect(resultJson)
- ? JSON.format(resultJson) : e.getMessage() + "\n\n\n" + error);
- }
- }
- });
- }
-
-
-
-
- @Override
- public void finish() {
- setResult(RESULT_OK, new Intent().putExtra(RESULT_ID, id).putExtra(RESULT_URL, url));
- super.finish();
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- isAlive = false;
- }
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/ui/SelectActivity.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/ui/SelectActivity.java
deleted file mode 100644
index 796c61def..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/ui/SelectActivity.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.ui;
-
-import zuo.biao.apijson.JSON;
-import zuo.biao.apijson.StringUtil;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.net.Uri;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.Toast;
-import apijson.demo.R;
-import apijson.demo.RequestUtil;
-
-import com.alibaba.fastjson.JSONObject;
-
-/**选择Activity
- * 选择向服务器发起的请求
- * @author Lemon
- */
-public class SelectActivity extends Activity implements OnClickListener {
-
-
- private static final String KEY_ID = "id";
- private static final String KEY_URL = "url";
-
-
- private Activity context;
-
- private long id;
- private String url;
-
- private Button[] buttons;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.select_activity);
- context = this;
-
-
- //读取保存的配置
- SharedPreferences sp = getSharedPreferences(getPackageName() + "_config", Context.MODE_PRIVATE);
- id = sp.getLong(KEY_ID, id);
- url = sp.getString(KEY_URL, null);
-
-
- buttons = new Button[10];
- buttons[0] = (Button) findViewById(R.id.btnSelectPost);
- buttons[1] = (Button) findViewById(R.id.btnSelectPut);
- buttons[2] = (Button) findViewById(R.id.btnSelectDelete);
- buttons[3] = (Button) findViewById(R.id.btnSelectSingle);
- buttons[4] = (Button) findViewById(R.id.btnSelectColumns);
- buttons[5] = (Button) findViewById(R.id.btnSelectRely);
- buttons[6] = (Button) findViewById(R.id.btnSelectArray);
- buttons[7] = (Button) findViewById(R.id.btnSelectComplex);
- buttons[8] = (Button) findViewById(R.id.btnSelectAccessError);
- buttons[9] = (Button) findViewById(R.id.btnSelectAccessPermitted);
-
-
- setRequest();
-
-
- for (int i = 0; i < buttons.length; i++) {
- buttons[i].setOnClickListener(this);
- }
-
- findViewById(R.id.btnSelectUpdateLog).setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
- StringUtil.getCorrectUrl("github.com/TommyLemon/APIJSON/commits/master"))));
- }
- });
-
- }
-
-
-
- /**
- */
- public void setRequest() {
- for (int i = 0; i < buttons.length; i++) {
- buttons[i].setText(JSON.format(getRequest(buttons[i], false)));
- }
- }
-
- /**
- * @param v
- * @return
- */
- public JSONObject getRequest(View v, boolean encode) {
- switch (v.getId()) {
- case R.id.btnSelectPost:
- return RequestUtil.newPostRequest(encode);
- case R.id.btnSelectPut:
- return RequestUtil.newPutRequest(id, encode);
- case R.id.btnSelectDelete:
- return RequestUtil.newDeleteRequest(id, encode);
-
- case R.id.btnSelectSingle:
- return RequestUtil.newSingleRequest(id, encode);
- case R.id.btnSelectColumns:
- return RequestUtil.newColumnsRequest(id, encode);
- case R.id.btnSelectRely:
- return RequestUtil.newRelyRequest(id, encode);
- case R.id.btnSelectArray:
- return RequestUtil.newArrayRequest(encode);
-
- case R.id.btnSelectAccessError:
- return RequestUtil.newAccessErrorRequest(encode);
- case R.id.btnSelectAccessPermitted:
- return RequestUtil.newAccessPermittedRequest(encode);
- default:
- return RequestUtil.newComplexRequest(encode);
- }
- }
-
-
-
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.btnSelectPost:
- select(getRequest(v, true), "post");
- break;
- case R.id.btnSelectPut:
- select(getRequest(v, true), "put");
- break;
- case R.id.btnSelectDelete:
- select(getRequest(v, true), "delete");
- break;
-
- case R.id.btnSelectAccessError:
- select(getRequest(v, true), "post_get");
- break;
- case R.id.btnSelectAccessPermitted:
- select(getRequest(v, true), "post_get");
- break;
-
- default:
- select(getRequest(v, true), "get");
- break;
- }
- }
-
-
- private void select(JSONObject request, String method) {
- startActivityForResult(RequestActivity.createIntent(context, id, url, method, request), REQUEST_TO_REQUEST);
- }
-
-
-
- private static final int REQUEST_TO_REQUEST = 1;
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode != RESULT_OK) {
- return;
- }
- switch (requestCode) {
- case REQUEST_TO_REQUEST:
- if (data == null) {
- Toast.makeText(context, "onActivityResult data == null !!!", Toast.LENGTH_SHORT).show();
- } else {
- id = data.getLongExtra(RequestActivity.RESULT_ID, id);
- url = data.getStringExtra(RequestActivity.RESULT_URL);
-
- setRequest();
-
- //保存配置
- getSharedPreferences(getPackageName() + "_config", Context.MODE_PRIVATE)
- .edit()
- .remove(KEY_ID)
- .putLong(KEY_ID, id)
- .remove(KEY_URL)
- .putString(KEY_URL, url)
- .commit();
- }
- break;
- default:
- break;
- }
- }
-
-
-
-
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/ui/package-info.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/ui/package-info.java
deleted file mode 100644
index c31dbee2e..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/java/apijson/demo/ui/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * 界面相关类所在包
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo.ui;
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-hdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index cde69bccc..000000000
Binary files a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-mdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-mdpi/ic_launcher.png
deleted file mode 100755
index c133a0cbd..000000000
Binary files a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-xhdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100755
index bfa42f0e7..000000000
Binary files a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100755
index 324e72cdd..000000000
Binary files a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable/ic_launcher.png b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable/ic_launcher.png
deleted file mode 100644
index cde69bccc..000000000
Binary files a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/drawable/ic_launcher.png and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/layout/request_activity.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/layout/request_activity.xml
deleted file mode 100644
index 758c1acf7..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/layout/request_activity.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/layout/select_activity.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/layout/select_activity.xml
deleted file mode 100644
index 32de20861..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/layout/select_activity.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values-en/strings.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values-en/strings.xml
deleted file mode 100644
index c2259a8f1..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values-en/strings.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- Request
- POST
- DELETE
- PUT
- GET
- Single
- Columns
- Rely
- Array
- Complex
- Access Error
- Access Permitted
- Update Log
- received result!
- Browsers can only receive GET responses
- There may be something wrong,you can follow by the steps:\n\n1.Check your net connection\n\n2.Check the url whether it\'s an available ipv4 address\n\n3.Long click the [ %1$s ] button to open the request by web browser\n\n4.Check logs outputed on the target server\n\n5.Try again
- APIJSON, let interfaces go to hell!
- APIJSON is a JSON Transmission Structure Protocol…
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values/dimens.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values/dimens.xml
deleted file mode 100644
index 55c1e5908..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
- 16dp
- 16dp
-
-
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values/strings.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values/strings.xml
deleted file mode 100644
index cc5c86e1e..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- APIJSON
- 2.0
- 请求
- 增
- 删
- 改
- 查
- 单个Object
- 指定字段
- 向上依赖
- Object数组
- 复杂结构
- 没有访问权限
- 允许使用权限
- 更新日志
- 已获得结果!
- 用浏览器只能获取GET结果
- 可能出现了一些问题,可以按照以下步骤解决:\n\n1.检查网络连接\n\n2.检查url是否为一个可用的IPV4地址\n\n3.长按[ %1$s ]按钮用浏览器发送请求\n\n4.查看目标服务器上的log\n\n5.再试一次
- APIJSON, let interfaces go to hell!
- APIJSON is a JSON Transmission Structure Protocol…
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values/styles.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values/styles.xml
deleted file mode 100644
index 69e2137a1..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/test/java/apijson/demo/ExampleUnitTest.java b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/test/java/apijson/demo/ExampleUnitTest.java
deleted file mode 100644
index 5fc589b9e..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/app/src/test/java/apijson/demo/ExampleUnitTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package apijson.demo;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * To work on unit tests, switch the Test Artifact in the Build Variants view.
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/build.gradle b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/build.gradle
deleted file mode 100644
index aff4f415e..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/build.gradle
+++ /dev/null
@@ -1,23 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
-buildscript {
- repositories {
- jcenter()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:2.1.2'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
-}
-
-allprojects {
- repositories {
- jcenter()
- }
-}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/build/generated/mockable-android-23.jar b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/build/generated/mockable-android-23.jar
deleted file mode 100644
index bf64c1fc9..000000000
Binary files a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/build/generated/mockable-android-23.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/build/intermediates/dex-cache/cache.xml b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/build/intermediates/dex-cache/cache.xml
deleted file mode 100644
index b72b52871..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/build/intermediates/dex-cache/cache.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradle.properties b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradle.properties
deleted file mode 100644
index 1d3591c8a..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
\ No newline at end of file
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradle/wrapper/gradle-wrapper.jar b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 13372aef5..000000000
Binary files a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradle/wrapper/gradle-wrapper.properties b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 122a0dca2..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Mon Dec 28 10:00:20 PST 2015
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradlew b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradlew
deleted file mode 100755
index 9d82f7891..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradlew
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradlew.bat b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradlew.bat
deleted file mode 100644
index aec99730b..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/local.properties b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/local.properties
deleted file mode 100644
index 0394cc101..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/local.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-## This file is automatically generated by Android Studio.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must *NOT* be checked into Version Control Systems,
-# as it contains information specific to your local configuration.
-#
-# Location of the SDK. This is only used by Gradle.
-# For customization when using a Version Control System, please read the
-# header note.
-#Wed Jan 25 15:53:14 CST 2017
-ndk.dir=/Users/Tommy/Library/Android/sdk/ndk-bundle
-sdk.dir=/Users/Tommy/Library/Android/sdk
diff --git a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/settings.gradle b/APIJSON(Android)/APIJSON(AndroidStudio)/Test/settings.gradle
deleted file mode 100644
index 7be30b688..000000000
--- a/APIJSON(Android)/APIJSON(AndroidStudio)/Test/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':app', ':APIJSONLibrary'
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/.gitignore b/APIJSON(Server)/APIJSON(Eclipse_JEE)/.gitignore
deleted file mode 100755
index 2af7cefb0..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-target/
-!.mvn/wrapper/maven-wrapper.jar
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-nbproject/private/
-build/
-nbbuild/
-dist/
-nbdist/
-.nb-gradle/
\ No newline at end of file
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/.mvn/wrapper/maven-wrapper.jar b/APIJSON(Server)/APIJSON(Eclipse_JEE)/.mvn/wrapper/maven-wrapper.jar
deleted file mode 100755
index 5fd4d5023..000000000
Binary files a/APIJSON(Server)/APIJSON(Eclipse_JEE)/.mvn/wrapper/maven-wrapper.jar and /dev/null differ
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/.mvn/wrapper/maven-wrapper.properties b/APIJSON(Server)/APIJSON(Eclipse_JEE)/.mvn/wrapper/maven-wrapper.properties
deleted file mode 100755
index c954cec91..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/.mvn/wrapper/maven-wrapper.properties
+++ /dev/null
@@ -1 +0,0 @@
-distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/.travis.yml b/APIJSON(Server)/APIJSON(Eclipse_JEE)/.travis.yml
deleted file mode 100755
index d036b68c1..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/.travis.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-language: java
-sudo: false
-jdk:
- - oraclejdk7
\ No newline at end of file
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/WebContent/META-INF/MANIFEST.MF b/APIJSON(Server)/APIJSON(Eclipse_JEE)/WebContent/META-INF/MANIFEST.MF
deleted file mode 100755
index 5e9495128..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/WebContent/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Class-Path:
-
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/WebContent/WEB-INF/web.xml b/APIJSON(Server)/APIJSON(Eclipse_JEE)/WebContent/WEB-INF/web.xml
deleted file mode 100755
index adb90bb16..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/WebContent/WEB-INF/web.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/apijson.eml b/APIJSON(Server)/APIJSON(Eclipse_JEE)/apijson.eml
deleted file mode 100755
index c9bcaf1c5..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/apijson.eml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/apijson.userlibraries b/APIJSON(Server)/APIJSON(Eclipse_JEE)/apijson.userlibraries
deleted file mode 100755
index 1f093e3b1..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/apijson.userlibraries
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/mvnw b/APIJSON(Server)/APIJSON(Eclipse_JEE)/mvnw
deleted file mode 100755
index a1ba1bf55..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/mvnw
+++ /dev/null
@@ -1,233 +0,0 @@
-#!/bin/sh
-# ----------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Maven2 Start Up Batch script
-#
-# Required ENV vars:
-# ------------------
-# JAVA_HOME - location of a JDK home dir
-#
-# Optional ENV vars
-# -----------------
-# M2_HOME - location of maven2's installed home dir
-# MAVEN_OPTS - parameters passed to the Java VM when running Maven
-# e.g. to debug Maven itself, use
-# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-# ----------------------------------------------------------------------------
-
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
- if [ -f /etc/mavenrc ] ; then
- . /etc/mavenrc
- fi
-
- if [ -f "$HOME/.mavenrc" ] ; then
- . "$HOME/.mavenrc"
- fi
-
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-mingw=false
-case "`uname`" in
- CYGWIN*) cygwin=true ;;
- MINGW*) mingw=true;;
- Darwin*) darwin=true
- #
- # Look for the Apple JDKs first to preserve the existing behaviour, and then look
- # for the new JDKs provided by Oracle.
- #
- if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
- #
- # Apple JDKs
- #
- export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
- fi
-
- if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
- #
- # Apple JDKs
- #
- export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
- fi
-
- if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
- #
- # Oracle JDKs
- #
- export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
- fi
-
- if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
- #
- # Apple JDKs
- #
- export JAVA_HOME=`/usr/libexec/java_home`
- fi
- ;;
-esac
-
-if [ -z "$JAVA_HOME" ] ; then
- if [ -r /etc/gentoo-release ] ; then
- JAVA_HOME=`java-config --jre-home`
- fi
-fi
-
-if [ -z "$M2_HOME" ] ; then
- ## resolve links - $0 may be a link to maven's home
- PRG="$0"
-
- # need this for relative symlinks
- while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG="`dirname "$PRG"`/$link"
- fi
- done
-
- saveddir=`pwd`
-
- M2_HOME=`dirname "$PRG"`/..
-
- # make it fully qualified
- M2_HOME=`cd "$M2_HOME" && pwd`
-
- cd "$saveddir"
- # echo Using m2 at $M2_HOME
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --unix "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
-fi
-
-# For Migwn, ensure paths are in UNIX format before anything is touched
-if $mingw ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME="`(cd "$M2_HOME"; pwd)`"
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
- # TODO classpath?
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- javaExecutable="`which javac`"
- if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
- # readlink(1) is not available as standard on Solaris 10.
- readLink=`which readlink`
- if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
- if $darwin ; then
- javaHome="`dirname \"$javaExecutable\"`"
- javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
- else
- javaExecutable="`readlink -f \"$javaExecutable\"`"
- fi
- javaHome="`dirname \"$javaExecutable\"`"
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
- JAVA_HOME="$javaHome"
- export JAVA_HOME
- fi
- fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- else
- JAVACMD="`which java`"
- fi
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly." >&2
- echo " We cannot execute $JAVACMD" >&2
- exit 1
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
- echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
-CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --path --windows "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
-fi
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
- local basedir=$(pwd)
- local wdir=$(pwd)
- while [ "$wdir" != '/' ] ; do
- if [ -d "$wdir"/.mvn ] ; then
- basedir=$wdir
- break
- fi
- wdir=$(cd "$wdir/.."; pwd)
- done
- echo "${basedir}"
-}
-
-# concatenates all lines of a file
-concat_lines() {
- if [ -f "$1" ]; then
- echo "$(tr -s '\n' ' ' < "$1")"
- fi
-}
-
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
-MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
-
-# Provide a "standardized" way to retrieve the CLI args that will
-# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
-export MAVEN_CMD_LINE_ARGS
-
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-exec "$JAVACMD" \
- $MAVEN_OPTS \
- -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
- "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${WRAPPER_LAUNCHER} "$@"
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/mvnw.cmd b/APIJSON(Server)/APIJSON(Eclipse_JEE)/mvnw.cmd
deleted file mode 100755
index 2b934e89d..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/mvnw.cmd
+++ /dev/null
@@ -1,145 +0,0 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Maven2 Start Up Batch script
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM M2_HOME - location of maven2's installed home dir
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-set MAVEN_CMD_LINE_ARGS=%*
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-
-set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar""
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
-
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
-
-exit /B %ERROR_CODE%
\ No newline at end of file
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/pom.xml b/APIJSON(Server)/APIJSON(Eclipse_JEE)/pom.xml
deleted file mode 100755
index 3e26692f0..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/pom.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
- 4.0.0
-
- zuo.biao.apijson.server
- apijson
- 0.0.1-SNAPSHOT
- jar
-
- APIJSON(Idea)
- APIJSON Server project using Spring Boot
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.4.1.RELEASE
-
-
-
-
- UTF-8
- UTF-8
- 1.7
-
-
-
-
- mysql
- mysql-connector-java
- 5.1.40
-
-
-
- org.springframework.boot
- spring-boot-starter
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- com.alibaba
- fastjson
- 1.2.21
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
-
-
-
- spring-snapshots
- http://repo.spring.io/snapshot
- true
-
-
- spring-milestones
- http://repo.spring.io/milestone
- true
-
-
-
-
- spring-snapshots
- http://repo.spring.io/snapshot
-
-
- spring-milestones
- http://repo.spring.io/milestone
-
-
-
-
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/apijson/demo/server/package-info.java b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/apijson/demo/server/package-info.java
deleted file mode 100644
index 487e27c06..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/apijson/demo/server/package-info.java
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * 示例服务端工程包
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo.server;
\ No newline at end of file
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/APIJSONRequest.java b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/APIJSONRequest.java
deleted file mode 100644
index a00fc0416..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/APIJSONRequest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**请求方法对应的JSON结构
- * @author Lemon
- */
-@Target({ElementType.METHOD, ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface APIJSONRequest {
-
- /**
- * @return 允许的请求方法
- */
- RequestMethod[] method() default {};
-
-
- /**@see {@link RequestMethod#POST_GET}
- * @return 该请求方法允许的结构
- */
- String POST_GET() default "";
-
- /**@see {@link RequestMethod#POST_HEAD}
- * @return 该请求方法允许的结构
- */
- String POST_HEAD() default "";
-
- /**@see {@link RequestMethod#POST}
- * @return 该请求方法允许的结构
- */
- String POST() default "";
-
- /**@see {@link RequestMethod#PUT}
- * @return 该请求方法允许的结构
- */
- String PUT() default "";
-
- /**@see {@link RequestMethod#DELETE}
- * @return 该请求方法允许的结构
- */
- String DELETE() default "";
-}
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/Column.java b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/Column.java
deleted file mode 100644
index e214c77e2..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/Column.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package zuo.biao.apijson;
-
-public class Column {
-
- private int count;//获得所有列的数目及实际列数
- private String name;//获得指定列的列名
- private String value;//获得指定列的列值
- private int type;//获得指定列的数据类型
- private String typeName;//获得指定列的数据类型名
- private String catalogName;//所在的Catalog名字
- private String className;//对应数据类型的类
- private int displaySize;//在数据库中类型的最大字符个数
- private String label;//默认的列的标题
- private String schemaName;//获得列的模式
- private int precision;//某列类型的精确度(类型的长度)
- private int scale;//小数点后的位数
- private String table;//获取某列对应的表名
- private boolean autoInctement;// 是否自动递增
- private boolean isCurrency;//在数据库中是否为货币型
- private int nullable;//是否为空
- private boolean readOnly;//是否为只读
- private boolean searchable;//能否出现在where中
-
- public Column() {
- super();
- }
- public Column(String name) {
- this();
- setName(name);
- }
- public int getCount() {
- return count;
- }
- public void setCount(int count) {
- this.count = count;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getValue() {
- return value;
- }
- public void setValue(String value) {
- this.value = value;
- }
- public int getType() {
- return type;
- }
- public void setType(int type) {
- this.type = type;
- }
- public String getTypeName() {
- return typeName;
- }
- public void setTypeName(String typeName) {
- this.typeName = typeName;
- }
- public String getCatalogName() {
- return catalogName;
- }
- public void setCatalogName(String catalogName) {
- this.catalogName = catalogName;
- }
- public String getClassName() {
- return className;
- }
- public void setClassName(String className) {
- this.className = className;
- }
- public int getDisplaySize() {
- return displaySize;
- }
- public void setDisplaySize(int displaySize) {
- this.displaySize = displaySize;
- }
- public String getLabel() {
- return label;
- }
- public void setLabel(String label) {
- this.label = label;
- }
- public String getSchemaName() {
- return schemaName;
- }
- public void setSchemaName(String schemaName) {
- this.schemaName = schemaName;
- }
- public int getPrecision() {
- return precision;
- }
- public void setPrecision(int precision) {
- this.precision = precision;
- }
- public int getScale() {
- return scale;
- }
- public void setScale(int scale) {
- this.scale = scale;
- }
- public String getTable() {
- return table;
- }
- public void setTable(String table) {
- this.table = table;
- }
- public boolean isAutoInctement() {
- return autoInctement;
- }
- public void setAutoInctement(boolean autoInctement) {
- this.autoInctement = autoInctement;
- }
- public boolean getIsCurrency() {
- return isCurrency;
- }
- public void setIsCurrency(boolean isCurrency) {
- this.isCurrency = isCurrency;
- }
- public int getNullable() {
- return nullable;
- }
- public void setNullable(int nullable) {
- this.nullable = nullable;
- }
- public boolean getReadOnly() {
- return readOnly;
- }
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
- public boolean getSearchable() {
- return searchable;
- }
- public void setSearchable(boolean searchable) {
- this.searchable = searchable;
- }
-
-}
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/Entry.java b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/Entry.java
deleted file mode 100644
index e3aa664eb..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/Entry.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*Copyright ©2015 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-/**自定义Entry
- * *java.util.Map.Entry是interface,new Entry(...)不好用,其它的Entry也不好用
- * @author Lemon
- * @param key
- * @param value
- * @use new Entry(...)
- * @warn K,V都需要基本类型时不建议使用,判空麻烦,不如新建一个Model
- */
-public class Entry {
-
- public K key;
- public V value;
-
- public Entry() {
- //default
- }
- public Entry(K key) {
- this(key, null);
- }
- public Entry(K key, V value) {
- this.key = key;
- this.value = value;
- }
-
-
- public K getKey() {
- return key;
- }
- public void setKey(K key) {
- this.key = key;
- }
- public V getValue() {
- return value;
- }
- public void setValue(V value) {
- this.value = value;
- }
-
-}
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/FunctionList.java b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/FunctionList.java
deleted file mode 100644
index 6dc2d3407..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/FunctionList.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**可远程调用的函数列表
- * @author Lemon
- */
-public interface FunctionList {
-
- //判断是否为空 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- /**判断collection是否为空
- * @param collection
- * @return
- */
- public boolean isEmpty(Collection collection);
- /**判断map是否为空
- * @param
- * @param
- * @param map
- * @return
- */
- public boolean isEmpty(Map map);
- //判断是否为空 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //判断是否为包含 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- /**判断collection是否包含object
- * @param collection
- * @param object
- * @return
- */
- public boolean isContain(Collection collection, T object);
- /**判断map是否包含key
- * @param
- * @param
- * @param map
- * @param key
- * @return
- */
- public boolean isContainKey(Map map, K key);
- /**判断map是否包含value
- * @param
- * @param
- * @param map
- * @param value
- * @return
- */
- public boolean isContainValue(Map map, V value);
- //判断是否为包含 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //获取集合长度 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- /**获取数量
- * @param
- * @param array
- * @return
- */
- public int count(T[] array);
- /**获取数量
- * @param
- * @param collection List, Vector, Set等都是Collection的子类
- * @return
- */
- public int count(Collection collection);
- /**获取数量
- * @param
- * @param
- * @param map
- * @return
- */
- public int count(Map map);
- //获取集合长度 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //获取集合长度 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- /**获取
- * @param
- * @param array
- * @return
- */
- public T get(T[] array, int position);
- /**获取
- * @param
- * @param collection List, Vector, Set等都是Collection的子类
- * @return
- */
- public T get(Collection collection, int position);
- /**获取
- * @param
- * @param
- * @param map null ? null
- * @param key null ? null : map.get(key);
- * @return
- */
- public V get(Map map, K key);
- //获取集合长度 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- //获取非基本类型对应基本类型的非空值 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- /**获取非空值
- * @param value
- * @return
- */
- public boolean value(Boolean value);
- /**获取非空值
- * @param value
- * @return
- */
- public int value(Integer value);
- /**获取非空值
- * @param value
- * @return
- */
- public long value(Long value);
- /**获取非空值
- * @param value
- * @return
- */
- public float value(Float value);
- /**获取非空值
- * @param value
- * @return
- */
- public double value(Double value);
- //获取非基本类型对应基本类型的非空值 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSON.java b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSON.java
deleted file mode 100755
index 9d9d8cc79..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSON.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import java.util.List;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.parser.Feature;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-
-import zuo.biao.apijson.server.Log;
-
-/**阿里json封装类 防止解析时异常
- * @author Lemon
- */
-public class JSON {
- private static final String TAG = "JSON";
-
- /**判断json格式是否正确
- * @param s
- * @return
- */
- public static boolean isJsonCorrect(String s) {
- Log.i(TAG, "isJsonCorrect <<<< " + s + " >>>>>>>");
- if (s == null
- // || s.equals("[]")
- // || s.equals("{}")
- || s.equals("")
- || s.equals("[null]")
- || s.equals("{null}")
- || s.equals("null")) {
- return false;
- }
- return true;
- }
-
- /**获取有效的json
- * @param s
- * @return
- */
- public static String getCorrectJson(String s) {
- return getCorrectJson(s, false);
- }
- /**获取有效的json
- * @param s
- * @param isArray
- * @return
- */
- public static String getCorrectJson(String s, boolean isArray) {
- s = StringUtil.getTrimedString(s);
- // if (isArray) {
- // if (s.startsWith("\"")) {
- // s = s.substring(1);
- // }
- // if (s.endsWith("\"")) {
- // s = s.substring(0, s.length() - 1);
- // }
- // }
- return s;//isJsonCorrect(s) ? s : null;
- }
-
- /**json转JSONObject
- * @param json
- * @return
- */
- public static JSONObject parseObject(Object obj) {
- return parseObject(toJSONString(obj));
- }
- /**json转JSONObject
- * @param json
- * @return
- */
- public static JSONObject parseObject(String json) {
- int features = com.alibaba.fastjson.JSON.DEFAULT_PARSER_FEATURE;
- features |= Feature.OrderedField.getMask();
- return parseObject(json, features);
- }
- /**json转JSONObject
- * @param json
- * @param features
- * @return
- */
- public static JSONObject parseObject(String json, int features) {
- try {
- return com.alibaba.fastjson.JSON.parseObject(getCorrectJson(json), JSONObject.class, features);
- } catch (Exception e) {
- Log.i(TAG, "parseObject catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**JSONObject转实体类
- * @param object
- * @param clazz
- * @return
- */
- public static T parseObject(JSONObject object, Class clazz) {
- return parseObject(toJSONString(object), clazz);
- }
- /**json转实体类
- * @param json
- * @param clazz
- * @return
- */
- public static T parseObject(String json, Class clazz) {
- try {
- int features = com.alibaba.fastjson.JSON.DEFAULT_PARSER_FEATURE;
- features |= Feature.OrderedField.getMask();
- return com.alibaba.fastjson.JSON.parseObject(getCorrectJson(json), clazz, features);
- } catch (Exception e) {
- Log.i(TAG, "parseObject catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**json转JSONArray
- * @param json
- * @return
- */
- public static JSONArray parseArray(String json) {
- try {
- return com.alibaba.fastjson.JSON.parseArray(getCorrectJson(json, true));
- } catch (Exception e) {
- Log.i(TAG, "parseArray catch \n" + e.getMessage());
- }
- return null;
- }
- /**JSONArray转实体类列表
- * @param array
- * @param clazz
- * @return
- */
- public static List parseArray(JSONArray array, Class clazz) {
- return parseArray(toJSONString(array), clazz);
- }
- /**json转实体类列表
- * @param json
- * @param clazz
- * @return
- */
- public static List parseArray(String json, Class clazz) {
- try {
- return com.alibaba.fastjson.JSON.parseArray(getCorrectJson(json, true), clazz);
- } catch (Exception e) {
- Log.i(TAG, "parseArray catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**实体类转json
- * @param obj
- * @return
- */
- public static String toJSONString(Object obj) {
- if (obj instanceof String) {
- return (String) obj;
- }
- try {
- return com.alibaba.fastjson.JSON.toJSONString(obj);
- } catch (Exception e) {
- Log.i(TAG, "toJSONString catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**实体类转json
- * @param obj
- * @param features
- * @return
- */
- public static String toJSONString(Object obj, SerializerFeature... features) {
- if (obj instanceof String) {
- return (String) obj;
- }
- try {
- return com.alibaba.fastjson.JSON.toJSONString(obj, features);
- } catch (Exception e) {
- Log.i(TAG, "toJSONString catch \n" + e.getMessage());
- }
- return null;
- }
-
- /**格式化,显示更好看
- * @param json
- * @return
- */
- public static String format(String json) {
- return format(parseObject(json));
- }
- /**格式化,显示更好看
- * @param object
- * @return
- */
- public static String format(JSONObject object) {
- return toJSONString(object, SerializerFeature.PrettyFormat);
- }
-
- /**判断是否为JSONObject
- * @param obj instanceof String ? parseObject
- * @return
- */
- public static boolean isJSONObject(Object obj) {
- if (obj instanceof JSONObject) {
- return true;
- }
- if (obj instanceof String) {
- try {
- JSONObject json = parseObject((String) obj);
- return json != null && json.isEmpty() == false;
- } catch (Exception e) {
- //太长 System.out.println(TAG + "select while (rs.next()){ >> i = "
- // + i + " try { json = JSON.parse((String) value);"
- // + ">> } catch (Exception e) {\n" + e.getMessage());
- }
- }
-
- return false;
- }
- /**判断是否为JSONArray
- * @param obj instanceof String ? parseArray
- * @return
- */
- public static boolean isJSONArray(Object obj) {
- if (obj instanceof JSONArray) {
- return true;
- }
- if (obj instanceof String) {
- try {
- JSONArray json = parseArray((String) obj);
- return json != null && json.isEmpty() == false;
- } catch (Exception e) {
- //太长 System.out.println(TAG + "select while (rs.next()){ >> i = "
- // + i + " try { json = JSON.parse((String) value);"
- // + ">> } catch (Exception e) {\n" + e.getMessage());
- }
- }
-
- return false;
- }
-
-
-}
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSONObject.java b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSONObject.java
deleted file mode 100644
index 9b109a3f0..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSONObject.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import static zuo.biao.apijson.StringUtil.UTF_8;
-import static zuo.biao.apijson.StringUtil.bigAlphaPattern;
-import static zuo.biao.apijson.StringUtil.namePattern;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.Set;
-
-
-/**use this class instead of com.alibaba.fastjson.JSONObject, not encode in default cases
- * @author Lemon
- */
-public class JSONObject extends com.alibaba.fastjson.JSONObject {
- private static final long serialVersionUID = 8907029699680768212L;
-
- /**ordered
- */
- public JSONObject() {
- super(true);
- }
- /**transfer Object to JSONObject
- * encode = false;
- * @param object
- * @see {@link #JSONObject(Object, boolean)}
- */
- public JSONObject(Object object) {
- this(object, false);
- }
- /**transfer Object to JSONObject
- * @param object
- * @param encode
- * @see {@link #JSONObject(String, boolean)}
- */
- public JSONObject(Object object, boolean encode) {
- this(toJSONString(object), encode);
- }
- /**parse JSONObject with JSON String
- * encode = false;
- * @param json
- * @see {@link #JSONObject(String, boolean)}
- */
- public JSONObject(String json) {
- this(json, false);
- }
- /**parse JSONObject with JSON String
- * @param json
- * @param encode
- * @see {@link #JSONObject(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject(String json, boolean encode) {
- this(parseObject(json), encode);
- }
- /**transfer com.alibaba.fastjson.JSONObject to JSONObject
- * encode = false;
- * @param object
- * @see {@link #JSONObject(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject(com.alibaba.fastjson.JSONObject object) {
- this(object, false);
- }
- /**transfer com.alibaba.fastjson.JSONObject to JSONObject
- * @param object
- * @param encode
- * @see {@link #add(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject(com.alibaba.fastjson.JSONObject object, boolean encode) {
- this();
- add(object, encode);
- }
-
-
-
-
- /**put key-value in object into this
- * encode = false;
- * @param object
- * @return {@link #add(com.alibaba.fastjson.JSONObject, boolean)}
- */
- public JSONObject add(com.alibaba.fastjson.JSONObject object) {
- return add(object, false);
- }
- /**put key-value in object into this
- * @param object
- * @param encode
- * @return this
- */
- public JSONObject add(com.alibaba.fastjson.JSONObject object, boolean encode) {
- Set set = object == null ? null : object.keySet();
- if (set != null) {
- for (String key : set) {
- put(key, object.get(key), encode);
- }
- }
- return this;
- }
-
-
-
- /**
- * @param key if decode && key instanceof String, key = URLDecoder.decode((String) key, UTF_8)
- * @param decode if decode && value instanceof String, value = URLDecoder.decode((String) value, UTF_8)
- * @return
- */
- public Object get(Object key, boolean decode) {
- if (decode) {
- if (key instanceof String) {
- if (((String) key).endsWith("+") || ((String) key).endsWith("-")) {
- try {//多层encode导致内部Comment[]传到服务端decode后最终变为Comment%5B%5D
- key = URLDecoder.decode((String) key, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- return null;
- }
- }
- }
- Object value = super.get(key);
- if (value instanceof String) {
- try {
- value = URLDecoder.decode((String) value, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
- return value;
- }
- return super.get(key);
- }
-
- /**
- * encode = false
- * @param value
- * @return {@link #put(String, boolean)}
- */
- public Object put(Object value) {
- return put(value, false);
- }
- /**
- * key = value.getClass().getSimpleName()
- * @param value
- * @param encode
- * @return {@link #put(String, Object, boolean)}
- */
- public Object put(Object value, boolean encode) {
- return put(null, value, encode);
- }
- /**
- * @param key if StringUtil.isNotEmpty(key, true) == false,
- *
key = value == null ? null : value.getClass().getSimpleName();
- *
>> if decode && key instanceof String, key = URLDecoder.decode((String) key, UTF_8)
- * @param value URLEncoder.encode((String) value, UTF_8);
- * @param encode if value instanceof String, value = URLEncoder.encode((String) value, UTF_8);
- * @return
- */
- public Object put(String key, Object value, boolean encode) {
- if (StringUtil.isNotEmpty(key, true) == false) {
- key = value == null ? null : value.getClass().getSimpleName();
- }
- if (encode) {
- if (key.endsWith("+") || key.endsWith("-")) {
- try {//多层encode导致内部Comment[]传到服务端decode后最终变为Comment%5B%5D
- key = URLEncoder.encode(key, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
- if (value instanceof String) {//只在value instanceof String时encode key?{@link #get(Object, boolean)}内做不到
- try {
- value = URLEncoder.encode((String) value, UTF_8);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
- }
- return super.put(key, value);
- }
-
-
-
- //judge <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- public static final String KEY_ARRAY = "[]";
-
- /**判断是否为Array的key
- * @param key
- * @return
- */
- public static boolean isArrayKey(String key) {
- return key != null && key.endsWith(KEY_ARRAY);
- }
- /**判断是否为对应Table的key
- * @param key
- * @return
- */
- public static boolean isTableKey(String key) {
- return isWord(key) && bigAlphaPattern.matcher(key.substring(0, 1)).matches();
- }
- /**判断是否为词,只能包含字母,数字或下划线
- * @param key
- * @return
- */
- public static boolean isWord(String key) {
- return StringUtil.isNotEmpty(key, false) && namePattern.matcher(key).matches();
- }
- //judge >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- public static final String KEY_COLUMNS = "@columns";//@key关键字都放这个类
-
- /**set columns need to be returned
- * @param columns "column0,column1,column2..."
- * @return
- */
- public JSONObject setColumns(String columns) {
- put(KEY_COLUMNS, columns);
- return this;
- }
- public String getColumns() {
- return getString(KEY_COLUMNS);
- }
-
-
-}
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSONRequest.java b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSONRequest.java
deleted file mode 100644
index 75db0dc3c..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSONRequest.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-/**encapsulator for request JSONObject, encode in default cases
- * @author Lemon
- * @see #toArray
- * @use JSONRequest request = new JSONRequest(...);
- *
request.put(...);//not a must
- *
request.toArray(...);//not a must
- */
-public class JSONRequest extends JSONObject {
-
- private static final long serialVersionUID = -2223023180338466812L;
-
- public JSONRequest() {
- super();
- }
- /**
- * encode = true
- * @param object
- * @see {@link #JSONRequest(String, Object)}
- */
- public JSONRequest(Object object) {
- this(null, object);
- }
- /**
- * encode = true
- * @param name
- * @param object
- * @see {@link #JSONRequest(String, Object, boolean)}
- */
- public JSONRequest(String name, Object object) {
- this(name, object, true);
- }
- /**
- * @param object
- * @param encode
- * @see {@link #JSONRequest(String, Object, boolean)}
- */
- public JSONRequest(Object object, boolean encode) {
- this(null, object, encode);
- }
- /**
- * @param name
- * @param object
- * @param encode
- * @see {@link #put(String, Object, boolean)}
- */
- public JSONRequest(String name, Object object, boolean encode) {
- this();
- put(name, object, encode);
- }
-
-
-
-
-
-
- public static final String KEY_TAG = "tag";
-
- public JSONObject setTag(String tag) {
- put(KEY_TAG, tag);
- return this;
- }
- public String getTag() {
- return getString(KEY_TAG);
- }
-
-
- //array object <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final String KEY_COUNT = "count";
- public static final String KEY_PAGE = "page";
-
- public JSONRequest setCount(int count) {
- put(KEY_COUNT, count);
- return this;
- }
- public int getCount() {
- return getIntValue(KEY_COUNT);
- }
-
- public JSONRequest setPage(int page) {
- put(KEY_PAGE, page);
- return this;
- }
- public int getPage() {
- return getIntValue(KEY_PAGE);
- }
- //array object >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
- /**
- * @param value
- * @param parts path = parts[0] + "/" + parts[1] + "/" + parts[2] + ...
- * @return
- */
- public Object putPath(String key, String... parts) {
- String path = "";
- if (parts != null) {
- for (int i = 0; i < parts.length; i++) {
- path += (i > 0 ? "/" : "") + parts[i];
- }
- }
- return put(key, path);
- }
-
- // 导致JSONObject add >> get = null
- // /**
- // * decode = true
- // * @param key
- // * return {@link #get(Object, boolean)}
- // */
- // @Override
- // public Object get(Object key) {
- // return get(key, true);
- // }
-
- /**
- * encode = true
- * @param value
- * @return {@link #put(String, boolean)}
- */
- public Object put(Object value) {
- return put(value, true);
- }
- /**
- * encode = true
- * @param key
- * @param value
- * return {@link #put(String, Object, boolean)}
- */
- @Override
- public Object put(String key, Object value) {
- return put(key, value, true);
- }
-
-
- /**create a parent JSONObject named KEY_ARRAY
- * encode = true;
- * @param count
- * @param page
- * @return {@link #toArray(int, int, boolean)}
- */
- public JSONRequest toArray(int count, int page) {
- return toArray(count, page, true);
- }
- /**create a parent JSONObject named KEY_ARRAY
- * encode = true;
- * @param count
- * @param page
- * @return {@link #toArray(int, int, String, boolean)}
- */
- public JSONRequest toArray(int count, int page, boolean encode) {
- return toArray(count, page, null, encode);
- }
- /**create a parent JSONObject named name+KEY_ARRAY
- * encode = true;
- * @param count
- * @param page
- * @param name
- * @return {@link #toArray(int, int, String, boolean)}
- */
- public JSONRequest toArray(int count, int page, String name) {
- return toArray(count, page, name, true);
- }
- /**create a parent JSONObject named name+KEY_ARRAY
- * @param count
- * @param page
- * @param name
- * @param encode
- * @return {name+KEY_ARRAY : this}
- */
- public JSONRequest toArray(int count, int page, String name, boolean encode) {
- return new JSONRequest(StringUtil.getString(name) + KEY_ARRAY, this.setCount(count).setPage(page), encode);
- }
-
-
- /**设置搜索
- * @param key
- * @param value
- * @see {@link #putSearch(String, String, int)}
- */
- public void putSearch(String key, String value) {
- putSearch(key, value, SEARCH_TYPE_CONTAIN_FULL);
- }
- /**设置搜索
- * encode = true
- * @param key
- * @param value
- * @param type
- * @see {@link #putSearch(String, String, int, boolean)}
- */
- public void putSearch(String key, String value, int type) {
- putSearch(key, value, type, true);
- }
- /**设置搜索
- * @param key
- * @param value
- * @param type
- * @param encode
- */
- public void putSearch(String key, String value, int type, boolean encode) {
- if (key == null) {
- key = "";
- }
- if (key.endsWith("$") == false) {
- key += "$";
- }
- put(key, getSearch(value, type), encode);
- }
-
- public static final int SEARCH_TYPE_CONTAIN_FULL = 0;
- public static final int SEARCH_TYPE_CONTAIN_ORDER = 1;
- public static final int SEARCH_TYPE_CONTAIN_SINGLE = 2;
- public static final int SEARCH_TYPE_CONTAIN_ANY = 3;
- public static final int SEARCH_TYPE_START = 4;
- public static final int SEARCH_TYPE_END = 5;
- public static final int SEARCH_TYPE_START_SINGLE = 6;
- public static final int SEARCH_TYPE_END_SINGLE = 7;
- public static final int SEARCH_TYPE_PART_MATCH = 8;
- /**
- * SQL中NOT LIKE就行??
- */
- public static final int SEARCH_TYPE_NO_CONTAIN = 9;
- /**
- * SQL中NOT LIKE就行??
- */
- public static final int SEARCH_TYPE_NO_PART_MATCH = 10;
- /**获取搜索值
- * @param key
- * @return
- */
- public static String getSearch(String key) {
- return getSearch(key, SEARCH_TYPE_CONTAIN_FULL);
- }
- /**获取搜索值
- * @param key
- * @param type
- * @return
- */
- public static String getSearch(String key, int type) {
- return getSearch(key, type, true);
- }
- /**获取搜索值
- * @param key
- * @param type
- * @param ignoreCase
- * @return
- */
- public static String getSearch(String key, int type, boolean ignoreCase) {
- if (key == null) {
- return null;
- }
- switch (type) {
- case SEARCH_TYPE_CONTAIN_SINGLE:
- return "_" + key + "_";
- case SEARCH_TYPE_CONTAIN_ORDER:
- char[] cs = key.toCharArray();
- if (cs == null) {
- return null;
- }
- String s = "%";
- for (int i = 0; i < cs.length; i++) {
- s += cs[i] + "%";
- }
- return s;
- case SEARCH_TYPE_START:
- return key + "%";
- case SEARCH_TYPE_END:
- return "%" + key;
- case SEARCH_TYPE_START_SINGLE:
- return key + "_";
- case SEARCH_TYPE_END_SINGLE:
- return "_" + key;
- case SEARCH_TYPE_NO_CONTAIN:
- return "[^" + key + "]";
- case SEARCH_TYPE_NO_PART_MATCH:
- cs = key.toCharArray();
- if (cs == null) {
- return null;
- }
- s = "";
- for (int i = 0; i < cs.length; i++) {
- s += getSearch("" + cs[i], SEARCH_TYPE_NO_CONTAIN, ignoreCase);
- }
- return s;
- default:
- return "%" + key + "%";
- }
- }
-
-
-}
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSONResponse.java b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSONResponse.java
deleted file mode 100644
index 11ca6d098..000000000
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSONResponse.java
+++ /dev/null
@@ -1,439 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package zuo.biao.apijson;
-
-import static zuo.biao.apijson.StringUtil.bigAlphaPattern;
-
-import java.util.List;
-import java.util.Set;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-import zuo.biao.apijson.server.Log;
-
-/**parser for response JSON String
- * @author Lemon
- * @see #getList
- * @see #toArray
- * @use JSONResponse response = new JSONResponse(...);
- *
JSONArray array = JSONResponse.toArray(response.getJSONObject(KEY_ARRAY));//not a must
- *
User user = JSONResponse.getObject(response, User.class);//not a must
- *
List list = JSONResponse.getList(response.getJSONObject("Comment[]"), Comment.class);//not a must
- */
-@SuppressWarnings("serial")
-public class JSONResponse extends zuo.biao.apijson.JSONObject {
- private static final String TAG = "JSONResponse";
-
- public JSONResponse() {
- super();
- }
- public JSONResponse(String json) {
- this(parseObject(json));
- }
- public JSONResponse(JSONObject object) {
- super(format(object));
- }
-
- //状态信息,非GET请求获得的信息<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final int STATUS_SUCCEED = 200;
-
-
- public static final String KEY_ID = "id";
- public static final String KEY_STATUS = "status";
- public static final String KEY_COUNT = "count";
- public static final String KEY_MESSAGE = "message";
-
- /**获取id
- * @return
- */
- public long getId() {
- return getLongValue(KEY_ID);
- }
- /**获取状态
- * @return
- */
- public int getStatus() {
- return getIntValue(KEY_STATUS);
- }
- /**获取数量
- * @return
- */
- public int getCount() {
- return getIntValue(KEY_COUNT);
- }
- /**获取信息
- * @return
- */
- public String getMessage() {
- return getString(KEY_MESSAGE);
- }
-
- /**是否成功
- * @return
- */
- public boolean isSucceed() {
- return isSucceed(getStatus());
- }
- /**是否成功
- * @param status
- * @return
- */
- public static boolean isSucceed(int status) {
- return status == STATUS_SUCCEED;
- }
- /**是否成功
- * @param response
- * @return
- */
- public static boolean isSucceed(JSONResponse response) {
- return response != null && response.isSucceed();
- }
-
- /**校验服务端是否存在table
- * @return
- */
- public boolean isExist() {
- return isExist(getCount());
- }
- /**校验服务端是否存在table
- * @param count
- * @return
- */
- public static boolean isExist(int count) {
- return count > 0;
- }
- /**校验服务端是否存在table
- * @param response
- * @return
- */
- public static boolean isExist(JSONResponse response) {
- return response != null && response.isExist();
- }
-
- /**获取内部的JSONResponse
- * @param key
- * @return
- */
- public JSONResponse getJSONResponse(String key) {
- return getObject(key, JSONResponse.class);
- }
- //状态信息,非GET请求获得的信息>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
- /**
- * key = clazz.getSimpleName()
- * @param clazz
- * @return
- */
- public T getObject(Class clazz) {
- return getObject(clazz == null ? "" : clazz.getSimpleName(), clazz);
- }
- /**
- * @param key
- * @param clazz
- * @return
- */
- public T getObject(String key, Class clazz) {
- return getObject(this, key, clazz);
- }
- /**
- * @param object
- * @param key
- * @param clazz
- * @return
- */
- public static T getObject(JSONObject object, String key, Class clazz) {
- return toObject(object == null ? null : object.getJSONObject(key), clazz);
- }
-
- /**
- * @param clazz
- * @return
- */
- public T toObject(Class clazz) {
- return toObject(this, clazz);
- }
- /**
- * @param object
- * @param clazz
- * @return
- */
- public static T toObject(JSONObject object, Class clazz) {
- return JSON.parseObject(JSON.toJSONString(object), clazz);
- }
-
-
-
-
- /**
- * key = KEY_ARRAY
- * @param clazz
- * @return
- */
- public List getList(Class clazz) {
- return getList(KEY_ARRAY, clazz);
- }
- /**
- * arrayObject = this
- * @param key
- * @param clazz
- * @return
- */
- public List getList(String key, Class clazz) {
- return getList(this, key, clazz);
- }
-
- /**
- * key = KEY_ARRAY
- * @param object
- * @param clazz
- * @return
- */
- public static List getList(JSONObject object, Class clazz) {
- return getList(object, KEY_ARRAY, clazz);
- }
- /**
- * @param object
- * @param key
- * @param clazz
- * @return
- */
- public static List getList(JSONObject object, String key, Class clazz) {
- Object obj = object == null ? null : object.get(replaceArray(key));
- if (obj == null) {
- return null;
- }
- return obj instanceof JSONArray ? JSON.parseArray((JSONArray) obj, clazz) : toList((JSONObject) obj, clazz);
- }
- /**
- * @param clazz
- * @return
- */
- public