Skip to content

Commit 6ed700e

Browse files
committed
[anno] [change di&json to basicLib]
1 parent 20e7b33 commit 6ed700e

File tree

14 files changed

+75
-82
lines changed

14 files changed

+75
-82
lines changed

app/build.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ android {
2626

2727
dependencies {
2828
compile project(':componentservice')
29-
30-
compile project(':jsonlib')
31-
32-
compile project(':dilib')
33-
3429
// annotationProcessor project(':router-anno-compiler')
3530
}
3631

app/src/main/java/com/mrzhang/component/application/AppApplication.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
import android.app.Application;
44

5-
import com.ljsw.component.di.serviceimpl.AutowiredServiceImpl;
6-
import com.ljsw.component.json.serviceimpl.JsonServiceImpl;
7-
import com.mrzhang.component.componentlib.router.Router;
8-
import com.mrzhang.componentservice.di.AutowiredService;
9-
import com.mrzhang.componentservice.json.JsonService;
10-
115
/**
126
* Created by mrzhang on 2017/6/15.
137
*/
@@ -21,14 +15,6 @@ public void onCreate() {
2115
//如果isRegisterCompoAuto为false,则需要通过反射加载组件
2216
// Router.registerComponent("com.mrzhang.reader.applike.ReaderAppLike");
2317
// Router.registerComponent("com.mrzhang.share.applike.ShareApplike");
24-
25-
// register jsonService
26-
Router.getInstance().addService(JsonService.class.getSimpleName(),
27-
new JsonServiceImpl());
28-
29-
// register DI-AutowiredService
30-
Router.getInstance().addService(AutowiredService.class.getSimpleName(),
31-
new AutowiredServiceImpl());
3218
}
3319

3420

componentlib/src/main/java/com/mrzhang/component/componentlib/router/RouterConstants.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

componentservice/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ android {
2424
dependencies {
2525
compile project(':componentlib')
2626
compile project(':basicres')
27+
compile project(':jsonlib')
28+
compile project(':dilib')
2729
compile fileTree(include: ['*.jar'], dir: 'libs')
2830
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
2931
exclude group: 'com.android.support', module: 'support-annotations'

componentservice/src/main/java/com/mrzhang/componentservice/di/AutowiredService.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

dilib/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ android {
2222
}
2323

2424
dependencies {
25-
compile project(':componentservice')
26-
2725
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
2826
exclude group: 'com.android.support', module: 'support-annotations'
2927
})
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.ljsw.component.di;
2+
3+
import com.ljsw.component.di.serviceimpl.AutowiredServiceImpl;
4+
5+
/**
6+
* <p><b>Package:</b> com.ljsw.component.di </p>
7+
* <p><b>Project:</b> DDComponentForAndroid </p>
8+
* <p><b>Classname:</b> AutowiredService </p>
9+
* <p><b>Description:</b> Autowired Dependency inject </p>
10+
* Created by leobert on 2017/9/18.
11+
*/
12+
13+
public interface AutowiredService {
14+
15+
/**
16+
* Autowired core.
17+
* @param instance the instance who need autowired.
18+
*/
19+
void autowire(Object instance);
20+
21+
22+
class Factory {
23+
private static Factory instance;
24+
25+
public static Factory getInstance() {
26+
if (instance == null) {
27+
instance = new Factory();
28+
}
29+
return instance;
30+
}
31+
32+
public AutowiredService create() {
33+
return new AutowiredServiceImpl();
34+
}
35+
}
36+
}

componentlib/src/main/java/com/mrzhang/component/componentlib/router/facade/ISyringe.java renamed to dilib/src/main/java/com/ljsw/component/di/route/ISyringe.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package com.mrzhang.component.componentlib.router.facade;
1+
package com.ljsw.component.di.route;
22

33
/**
4-
* <p><b>Package:</b> com.mrzhang.component.componentlib.router.facade </p>
4+
* <p><b>Package:</b> com.ljsw.component.di.route </p>
55
* <p><b>Project:</b> DDComponentForAndroid </p>
66
* <p><b>Classname:</b> ISyringe </p>
77
* <p><b>Description:</b> desc the function of Syringe, one that used to inject

dilib/src/main/java/com/ljsw/component/di/serviceimpl/AutowiredServiceImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
import android.util.LruCache;
44

5-
import com.mrzhang.component.componentlib.router.facade.ISyringe;
6-
import com.mrzhang.componentservice.di.AutowiredService;
5+
import com.ljsw.component.di.AutowiredService;
6+
import com.ljsw.component.di.route.ISyringe;
77

88
import java.util.ArrayList;
99
import java.util.List;
1010

11-
import static com.mrzhang.component.componentlib.router.RouterConstants.SUFFIX_AUTOWIRED;
1211

1312
/**
1413
* <p><b>Package:</b> com.ljsw.component.di.serviceimpl </p>
@@ -24,6 +23,8 @@ public class AutowiredServiceImpl implements AutowiredService {
2423
private LruCache<String, ISyringe> classCache = new LruCache<>(50);
2524
private List<String> blackList = new ArrayList<>();
2625

26+
//attention! make sure this keeps same with the one in AutowiredProcessor
27+
private static final String SUFFIX_AUTOWIRED = "$$Router$$Autowired";
2728

2829
@Override
2930
public void autowire(Object instance) {

jsonlib/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ android {
2222
}
2323

2424
dependencies {
25-
compile project(':componentservice')
2625
compile 'com.alibaba:fastjson:1.1.63.android'
2726

2827
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {

0 commit comments

Comments
 (0)