Skip to content

Commit f77b3b9

Browse files
committed
Server:同步eclipse版至idea版
1 parent 617b0ed commit f77b3b9

26 files changed

Lines changed: 1664 additions & 613 deletions

‎APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/OnParseCallback.java‎

Lines changed: 16 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1-
package zuo.biao.apijson;
1+
/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
26
3-
import java.util.LinkedHashSet;
4-
import java.util.Map.Entry;
5-
import java.util.Set;
7+
http://www.apache.org/licenses/LICENSE-2.0
68
7-
import javax.activation.UnsupportedDataTypeException;
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.*/
14+
15+
package zuo.biao.apijson;
816

917
import com.alibaba.fastjson.JSONArray;
1018
import com.alibaba.fastjson.JSONObject;
1119

20+
/**
21+
* @author Lemon
22+
*/
1223
public abstract class OnParseCallback {
1324

1425

15-
1626
/**
1727
* @param key
1828
* @param to
@@ -21,54 +31,6 @@ public abstract class OnParseCallback {
2131
* @throws Exception
2232
*/
2333
protected boolean onParse(String key, Object to, Object ro) throws Exception {
24-
// int operate = getOperate(key);
25-
// if (operate <= 0) {
26-
// return true;
27-
// }
28-
//
29-
// if (to instanceof JSONObject == false) {
30-
// throw new UnsupportedDataTypeException("服务器Request表配置错误!");
31-
// }
32-
// if (ro instanceof JSONObject == false) {
33-
// throw new UnsupportedDataTypeException(key + ":value 中 value不是JSONObject!");
34-
// }
35-
//
36-
// if (operate == OPERATE_PUT) {
37-
// ((JSONObject) ro).putAll((JSONObject) to);
38-
// return false;
39-
// }
40-
//
41-
// Set<Entry<String, Object>> set = new LinkedHashSet<>(((JSONObject) to).entrySet());
42-
// String k;
43-
// for (Entry<String, Object> e : set) {
44-
// k = e == null ? null : e.getKey();
45-
// if (k == null) {
46-
// continue;
47-
// }
48-
//
49-
// if (operate == OPERATE_VERIFY) {//TODO {}, $, <>
50-
//
51-
//
52-
// } else {
53-
// if (((JSONObject) ro).containsKey(k)) {
54-
// switch (operate) {
55-
// case OPERATE_REPLACE:
56-
// ((JSONObject) ro).put(k, e.getValue());
57-
// break;
58-
// case OPERATE_REMOVE:
59-
// ((JSONObject) ro).remove(k);
60-
// break;
61-
// }
62-
// } else {
63-
// if (operate == OPERATE_ADD) {
64-
// ((JSONObject) ro).put(k, e.getValue());
65-
// }
66-
// }
67-
// }
68-
// }
69-
//
70-
//
71-
// return false;
7234
return true;
7335
}
7436

‎APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/APIJSONApplication.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import org.springframework.boot.SpringApplication;
1818
import org.springframework.boot.autoconfigure.SpringBootApplication;
1919

20+
import zuo.biao.apijson.Structure;
21+
2022
/**application
2123
* @author Lemon
2224
*/
@@ -31,5 +33,11 @@ public static void main(String[] args) {
3133
} catch (Exception e) {
3234
e.printStackTrace();
3335
}
36+
37+
try {
38+
Structure.test();
39+
} catch (Exception e) {
40+
e.printStackTrace();
41+
}
3442
}
3543
}

‎APIJSON(Server)/APIJSON(Idea)/src/main/java/zuo/biao/apijson/APIJSONRequest.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@
3333
*/
3434
RequestMethod[] method() default {};
3535

36-
37-
/**@see {@link RequestMethod#POST_GET}
38-
* @return 该请求方法允许的结构
39-
*/
40-
String POST_GET() default "";
4136

4237
/**@see {@link RequestMethod#POST_HEAD}
4338
* @return 该请求方法允许的结构
4439
*/
4540
String POST_HEAD() default "";
41+
42+
/**@see {@link RequestMethod#POST_GET}
43+
* @return 该请求方法允许的结构
44+
*/
45+
String POST_GET() default "";
4646

4747
/**@see {@link RequestMethod#POST}
4848
* @return 该请求方法允许的结构
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.*/
14+
15+
package zuo.biao.apijson;
16+
17+
import com.alibaba.fastjson.JSONArray;
18+
import com.alibaba.fastjson.JSONObject;
19+
20+
/**
21+
* @author Lemon
22+
*/
23+
public abstract class OnParseCallback {
24+
25+
26+
/**
27+
* @param key
28+
* @param to
29+
* @param ro
30+
* @return false ? continue
31+
* @throws Exception
32+
*/
33+
protected boolean onParse(String key, Object to, Object ro) throws Exception {
34+
return true;
35+
}
36+
37+
/**
38+
* @param key
39+
* @param to
40+
* @param ro
41+
* @return
42+
* @throws Exception
43+
*/
44+
protected Object onParseObject(String key, Object to, Object ro) throws Exception {
45+
return ro;
46+
}
47+
48+
/**
49+
* @param key
50+
* @param tobj
51+
* @param robj
52+
* @return
53+
* @throws Exception
54+
*/
55+
protected JSONObject onParseJSONObject(String key, JSONObject tobj, JSONObject robj) throws Exception {
56+
return robj;
57+
}
58+
59+
/**
60+
* @param key
61+
* @param tarray
62+
* @param rarray
63+
* @return
64+
* @throws Exception
65+
*/
66+
protected JSONArray onParseJSONArray(String key, JSONArray tarray, JSONArray rarray) throws Exception {
67+
return rarray;
68+
}
69+
70+
}

0 commit comments

Comments
 (0)