Skip to content

Commit 4ee5bb3

Browse files
committed
第一次上传
1 parent 0b35c35 commit 4ee5bb3

File tree

459 files changed

+41223
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

459 files changed

+41223
-1
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ captures/
3434

3535
# Intellij
3636
*.iml
37-
.idea/workspace.xml
37+
.idea/
3838

3939
# Keystore files
4040
*.jks
41+
42+
.DS_Store

APIJSONLibrary/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

APIJSONLibrary/build.gradle

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion '23.0.2'
6+
defaultConfig {
7+
minSdkVersion 15
8+
targetSdkVersion 22
9+
versionCode 1
10+
versionName "1.0"
11+
}
12+
buildTypes {
13+
release {
14+
minifyEnabled false
15+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
16+
}
17+
}
18+
productFlavors {
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
testCompile 'junit:junit:4.12'
25+
compile files('libs/fastjson-1.2.24.jar')
26+
}
418 KB
Binary file not shown.

APIJSONLibrary/proguard-rules.pro

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/Tommy/Library/Android/sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package zuo.biao.apijson.client;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="zuo.biao.apijson.client"
4+
android:versionCode="1"
5+
android:versionName="1.0" >
6+
7+
<uses-sdk
8+
android:minSdkVersion="15"
9+
android:targetSdkVersion="21" />
10+
11+
<uses-permission android:name="android.permission.INTERNET" />
12+
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
13+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
14+
15+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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 java.lang.annotation.Documented;
18+
import java.lang.annotation.ElementType;
19+
import java.lang.annotation.Retention;
20+
import java.lang.annotation.RetentionPolicy;
21+
import java.lang.annotation.Target;
22+
23+
/**请求方法对应的JSON结构
24+
* @author Lemon
25+
*/
26+
@Target({ElementType.METHOD, ElementType.TYPE})
27+
@Retention(RetentionPolicy.RUNTIME)
28+
@Documented
29+
public @interface APIJSONRequest {
30+
31+
/**
32+
* @return 允许的请求方法
33+
*/
34+
RequestMethod[] method() default {};
35+
36+
37+
/**@see {@link RequestMethod#POST_GET}
38+
* @return 该请求方法允许的结构
39+
*/
40+
String POST_GET() default "";
41+
42+
/**@see {@link RequestMethod#POST_HEAD}
43+
* @return 该请求方法允许的结构
44+
*/
45+
String POST_HEAD() default "";
46+
47+
/**@see {@link RequestMethod#POST}
48+
* @return 该请求方法允许的结构
49+
*/
50+
String POST() default "";
51+
52+
/**@see {@link RequestMethod#PUT}
53+
* @return 该请求方法允许的结构
54+
*/
55+
String PUT() default "";
56+
57+
/**@see {@link RequestMethod#DELETE}
58+
* @return 该请求方法允许的结构
59+
*/
60+
String DELETE() default "";
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
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 java.io.Serializable;
18+
import java.util.Collection;
19+
import java.util.Map;
20+
21+
/**base model for reduce model codes
22+
* @author Lemon
23+
* @use extends BaseModel
24+
*/
25+
@SuppressWarnings("serial")
26+
public abstract class BaseModel implements Serializable {
27+
28+
private Long id;
29+
private Long date;
30+
31+
public Long getId() {
32+
return id;
33+
}
34+
public BaseModel setId(Long id) {
35+
this.id = id;
36+
return this;
37+
}
38+
public Long getDate() {
39+
return date;
40+
}
41+
public BaseModel setDate(Long date) {
42+
this.date = date;
43+
return this;
44+
}
45+
46+
//判断是否为空 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
47+
/**判断collection是否为空
48+
* @param collection
49+
* @return
50+
*/
51+
public static <T> boolean isEmpty(Collection<T> collection) {
52+
return collection == null || collection.isEmpty();
53+
}
54+
/**判断map是否为空
55+
* @param <K>
56+
* @param <V>
57+
* @param map
58+
* @return
59+
*/
60+
public static <K, V> boolean isEmpty(Map<K, V> map) {
61+
return map == null || map.isEmpty();
62+
}
63+
//判断是否为空 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
64+
65+
//判断是否包含 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
66+
/**判断collection是否包含object
67+
* @param collection
68+
* @param object
69+
* @return
70+
*/
71+
public static <T> boolean isContain(Collection<T> collection, T object) {
72+
return collection != null && collection.contains(object);
73+
}
74+
/**判断map是否包含key
75+
* @param <K>
76+
* @param <V>
77+
* @param map
78+
* @param key
79+
* @return
80+
*/
81+
public static <K, V> boolean isContainKey(Map<K, V> map, K key) {
82+
return map != null && map.containsKey(key);
83+
}
84+
/**判断map是否包含value
85+
* @param <K>
86+
* @param <V>
87+
* @param map
88+
* @param value
89+
* @return
90+
*/
91+
public static <K, V> boolean isContainValue(Map<K, V> map, V value) {
92+
return map != null && map.containsValue(value);
93+
}
94+
//判断是否为包含 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
95+
96+
97+
//获取集合长度 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
98+
/**获取数量
99+
* @param <T>
100+
* @param array
101+
* @return
102+
*/
103+
public static <T> int count(T[] array) {
104+
return array == null ? 0 : array.length;
105+
}
106+
/**获取数量
107+
* @param <T>
108+
* @param collection List, Vector, Set等都是Collection的子类
109+
* @return
110+
*/
111+
public static <T> int count(Collection<T> collection) {
112+
return collection == null ? 0 : collection.size();
113+
}
114+
/**获取数量
115+
* @param <K>
116+
* @param <V>
117+
* @param map
118+
* @return
119+
*/
120+
public static <K, V> int count(Map<K, V> map) {
121+
return map == null ? 0 : map.size();
122+
}
123+
//获取集合长度 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
124+
125+
126+
//获取集合长度 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
127+
/**获取
128+
* @param <T>
129+
* @param array
130+
* @return
131+
*/
132+
public static <T> T get(T[] array, int position) {
133+
return position < 0 || position >= count(array) ? null : array[position];
134+
}
135+
/**获取
136+
* @param <T>
137+
* @param collection List, Vector, Set等都是Collection的子类
138+
* @return
139+
*/
140+
@SuppressWarnings("unchecked")
141+
public static <T> T get(Collection<T> collection, int position) {
142+
return (T) (collection == null ? null : get(collection.toArray(), position));
143+
}
144+
/**获取
145+
* @param <K>
146+
* @param <V>
147+
* @param map null ? null
148+
* @param key null ? null : map.get(key);
149+
* @return
150+
*/
151+
public static <K, V> V get(Map<K, V> map, K key) {
152+
return key == null || map == null ? null : map.get(key);
153+
}
154+
//获取集合长度 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
155+
156+
157+
158+
//获取非基本类型对应基本类型的非空值 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
159+
/**获取非空值
160+
* @param value
161+
* @return
162+
*/
163+
public static boolean value(Boolean value) {
164+
return value == null ? false : value;
165+
}
166+
/**获取非空值
167+
* @param value
168+
* @return
169+
*/
170+
public static int value(Integer value) {
171+
return value == null ? 0 : value;
172+
}
173+
/**获取非空值
174+
* @param value
175+
* @return
176+
*/
177+
public static long value(Long value) {
178+
return value == null ? 0 : value;
179+
}
180+
/**获取非空值
181+
* @param value
182+
* @return
183+
*/
184+
public static float value(Float value) {
185+
return value == null ? 0 : value;
186+
}
187+
/**获取非空值
188+
* @param value
189+
* @return
190+
*/
191+
public static double value(Double value) {
192+
return value == null ? 0 : value;
193+
}
194+
//获取非基本类型对应基本类型的非空值 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
195+
196+
}

0 commit comments

Comments
 (0)