dm) {
15 | return null;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/drawable/selector_home_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/drawable/shape_button_gray.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/drawable/shape_button_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/drawable/shape_button_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/layout/header_data_binding.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #8c8c93
8 | #0064ff
9 |
10 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 15sp
5 | 20sp
6 | 25sp
7 | 30sp
8 | 35sp
9 |
10 | 20dp
11 | 30dp
12 |
13 |
14 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | data-binding-test
3 |
4 | Google one
5 | Google two
6 | Google three
7 | Google four
8 | Google five
9 |
10 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/data-binding-test/app/src/test/java/com/heaven7/data/mediator/data_binding_test/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.data.mediator.data_binding_test;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/data-binding-test/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/data-binding-test/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/data-binding-test/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-binding-test/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/data-binding-test/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Nov 06 13:30:05 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/data-binding-test/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':testgenerate'
2 |
--------------------------------------------------------------------------------
/data-binding-test/testgenerate/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/data-binding-test/testgenerate/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/data-binding-test/testgenerate/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/data-binding-test/testgenerate/src/main/java/com/heaven7/testgenerate/TestMockActivty1.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.testgenerate;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.widget.TextView;
5 |
6 | import com.heaven7.java.data.mediator.bind.BindText;
7 |
8 | /**
9 | * Created by heaven7 on 2017/11/6.
10 | */
11 |
12 | public class TestMockActivty1 extends AppCompatActivity {
13 |
14 | @BindText("tv_test_mock1")
15 | TextView mtv_test_mock1;
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/data-binding-test/testgenerate/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TestGenerate
3 |
4 |
--------------------------------------------------------------------------------
/data-mediator-annotations/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | *.class
3 | *.log
4 | *.ctxt
5 | .mtj.tmp/
6 | #*.jar
7 | *.war
8 | *.ear
9 | *.zip
10 | *.tar.gz
11 | *.rar
12 | hs_err_pid*
13 | .idea/*/*
14 | .idea/*
15 | .idea/.name
16 | .idea/copyright/
17 | .idea/dictionaries/
18 | .idea/encodings.xml
19 | .idea/workspace.xml
20 | classes/artifacts/data_mediator/
21 | src/test/resources/
22 |
--------------------------------------------------------------------------------
/data-mediator-annotations/build.gradle:
--------------------------------------------------------------------------------
1 | // apply plugin: 'java-library'
2 | apply plugin: "idea"
3 | apply plugin: 'java'
4 | apply plugin: 'com.novoda.bintray-release'
5 |
6 | sourceCompatibility = JavaVersion.VERSION_1_7
7 | targetCompatibility = JavaVersion.VERSION_1_7
8 |
9 | buildscript {
10 | repositories {
11 | jcenter {
12 | url "http://jcenter.bintray.com/"
13 | }
14 | }
15 | dependencies {
16 | classpath 'com.novoda:bintray-release:0.4.0'
17 | }
18 | }
19 |
20 | repositories {
21 | jcenter {
22 | url "http://jcenter.bintray.com/"
23 | }
24 | }
25 | allprojects {
26 | tasks.withType(Javadoc) {
27 | options.addStringOption('Xdoclint:none', '-quiet')
28 | options.addStringOption('encoding', 'UTF-8')
29 | }
30 | }
31 |
32 | dependencies {
33 | testCompile group: 'junit', name: 'junit', version: '4.11'
34 |
35 | compileOnly 'com.heaven7.java.data.mediator:data-mediator:1.4.5-beta6'
36 | }
37 | publish {
38 | userOrg = 'lightsun' //bintray user name
39 | groupId = 'com.heaven7.java.data.mediator.annotation'
40 | artifactId = 'data-mediator-annotations'
41 | publishVersion = '1.2.5-beta'
42 | desc = 'this is a annotation lib of data mediator. '
43 | website = 'https://github.com/LightSun/data-mediator'
44 | }
45 |
--------------------------------------------------------------------------------
/data-mediator-annotations/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-annotations/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/data-mediator-annotations/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Aug 28 10:15:54 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/data-mediator-annotations/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'data-mediator-annotations'
2 |
3 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/GlobalConfig.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * the global gson config for data-mediator.
10 | *
11 | * {@literal @}GlobalConfig(gsonConfig = @GsonConfig(
12 | version = 1.5, //the gson version which will used by GsonBuilder.
13 | generateJsonAdapter = true //default
14 | ))
15 | *
16 | * @since 1.0.5
17 | * @author heaven7
18 | */
19 | @Target(ElementType.TYPE)
20 | @Retention(RetentionPolicy.CLASS)
21 | public @interface GlobalConfig {
22 |
23 | /**
24 | * the gson configof 'Google/Gson'
25 | * @return the gson config.
26 | */
27 | GsonConfig gsonConfig() default @GsonConfig();
28 | }
29 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/ImportDesc.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Created by heaven7 on 2018/6/30.
10 | * @since 1.2.4
11 | */
12 | @Target(ElementType.TYPE)
13 | @Retention(RetentionPolicy.CLASS)
14 | public @interface ImportDesc {
15 |
16 | /**
17 | * the all alia names which are used in expression.
18 | * @return the alia names
19 | */
20 | String[] names();
21 |
22 | /**
23 | * the class which mapped by {@linkplain #names()}.
24 | * @return the import classes which is used as import static class.
25 | */
26 | Class>[] classes();
27 | }
28 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/Keep.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * indicate that the field or method should be keep. it will not effect by the intellij plugin of 'data-mediator'.
10 | *
11 | * {@literal @}keep
12 | int STATE_OK = 1;
13 | *
14 | * @author heaven7
15 | * @since 1.1.3
16 | */
17 | @Target({ElementType.METHOD, ElementType.FIELD})
18 | @Retention(RetentionPolicy.SOURCE)
19 | public @interface Keep {
20 | }
21 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindAny.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * the annotation which can bind any property to any view's any method.
10 | * It must be used in conjunction with {@linkplain BindMethodSupplierClass} and self Binder.
11 | *
12 | * {@literal @}BindAny(value = "text", method = "bindAppendText")
13 | TextView mTv_supplier;
14 | *
15 | * Created by heaven7 on 2017/11/16.
16 | * @since 1.2.1
17 | */
18 | @Retention(RetentionPolicy.CLASS)
19 | @Target(ElementType.FIELD)
20 | public @interface BindAny {
21 | /**
22 | * the property name of data-module which will be used to bind object.
23 | * @return the property name
24 | */
25 | String value();
26 |
27 | /**
28 | * the bind method name of Binder
29 | */
30 | String method();
31 |
32 | /**
33 | * the object index. which used for bind multi objects .
34 | * @return the object index.
35 | */
36 | int index() default 0;
37 | }
38 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindBackground.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind view background. it will auto set background drawable when you change background from proxy.
12 | *
13 | * {@literal @}BindBackground("background") TextView title;
14 | *
15 | * @author heaven7
16 | * @since 1.2.0
17 | */
18 | @Retention(RetentionPolicy.CLASS)
19 | @Target(ElementType.FIELD)
20 | @BindMethod("bindBackground")
21 | public @interface BindBackground {
22 |
23 | /**
24 | * the property name which will be used to bind object.
25 | * @return the property name
26 | */
27 | String value();
28 |
29 | /**
30 | * the object index. which used for bind multi objects .
31 | * @return the object index.
32 | */
33 | int index() default 0;
34 | }
35 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindBackgroundColor.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind view background color.it will auto set background color when you change background from proxy.
12 | *
13 | * {@literal @}BindBackgroundColor("backgroundColor") TextView title;
14 | *
15 | * @author heaven7
16 | * @since 1.2.0
17 | */
18 | @Retention(RetentionPolicy.CLASS)
19 | @Target(ElementType.FIELD)
20 | @BindMethod("bindBackgroundColor")
21 | public @interface BindBackgroundColor {
22 |
23 | /**
24 | * the property name which will be used to bind object.
25 | * @return the property name
26 | */
27 | String value();
28 |
29 | /**
30 | * the object index. which used for bind multi objects .
31 | * @return the object index.
32 | */
33 | int index() default 0;
34 | }
35 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindBackgroundRes.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind view background resource.
12 | * it will auto set background resource when you change background from proxy.
13 | *
14 | * {@literal @}BindBackgroundRes("backgroundRes") TextView title;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindBackgroundRes")
22 | public @interface BindBackgroundRes {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindCheckable.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind checkable of view . eg: android.widget.CheckBox.
12 | * it will auto set checked or not when you change check state from proxy.
13 | *
14 | * {@literal @}BindCheckable("checkable") CheckBox cb;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindCheckable")
22 | public @interface BindCheckable {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindEnable.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind enable of view . eg: android.view.View.
12 | * it will auto set enable or not when you change enable state from proxy.
13 | *
14 | * {@literal @}BindEnable("enable") TextView tv;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindEnable")
22 | public @interface BindEnable {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindHighlightColor.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * Created by heaven7 on 2017/11/16.
12 | * @since 1.2.1
13 | */
14 | @Retention(RetentionPolicy.CLASS)
15 | @Target(ElementType.FIELD)
16 | @BindMethod("bindHighlightColor")
17 | public @interface BindHighlightColor {
18 | /**
19 | * the property name which will be used to bind object.
20 | * @return the property name
21 | */
22 | String value();
23 |
24 | /**
25 | * the object index. which used for bind multi objects .
26 | * @return the object index.
27 | */
28 | int index() default 0;
29 | }
30 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindHintText.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * Created by heaven7 on 2017/11/16.
12 | * @since 1.2.1
13 | */
14 | @Retention(RetentionPolicy.CLASS)
15 | @Target(ElementType.FIELD)
16 | @BindMethod("bindHintText")
17 | public @interface BindHintText {
18 | /**
19 | * the property name which will be used to bind object.
20 | * @return the property name
21 | */
22 | String value();
23 |
24 | /**
25 | * the object index. which used for bind multi objects .
26 | * @return the object index.
27 | */
28 | int index() default 0;
29 | }
30 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindHintTextColor.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * Created by heaven7 on 2017/11/16.
12 | * @since 1.2.1
13 | */
14 | @Retention(RetentionPolicy.CLASS)
15 | @Target(ElementType.FIELD)
16 | @BindMethod("bindHintTextColor")
17 | public @interface BindHintTextColor {
18 |
19 | /**
20 | * the property name which will be used to bind object.
21 | * @return the property name
22 | */
23 | String value();
24 |
25 | /**
26 | * the object index. which used for bind multi objects .
27 | * @return the object index.
28 | */
29 | int index() default 0;
30 | }
31 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindHintTextColorRes.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * Created by heaven7 on 2017/11/16.
12 | * @since 1.2.1
13 | */
14 | @Retention(RetentionPolicy.CLASS)
15 | @Target(ElementType.FIELD)
16 | @BindMethod("bindHintTextColorRes")
17 | public @interface BindHintTextColorRes {
18 |
19 | /**
20 | * the property name which will be used to bind object.
21 | * @return the property name
22 | */
23 | String value();
24 |
25 | /**
26 | * the object index. which used for bind multi objects .
27 | * @return the object index.
28 | */
29 | int index() default 0;
30 | }
31 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindHintTextRes.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * Created by heaven7 on 2017/11/16.
12 | * @since 1.2.1
13 | */
14 | @Retention(RetentionPolicy.CLASS)
15 | @Target(ElementType.FIELD)
16 | @BindMethod("bindHintTextRes")
17 | public @interface BindHintTextRes {
18 | /**
19 | * the property name which will be used to bind object.
20 | * @return the property name
21 | */
22 | String value();
23 |
24 | /**
25 | * the object index. which used for bind multi objects .
26 | * @return the object index.
27 | */
28 | int index() default 0;
29 | }
30 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindImageBitmap.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind image bitmap of view . eg: ImageView.
12 | * it will auto set image bitmap when you change bitmap from proxy.
13 | *
14 | * {@literal @}BindImageBitmap("imageBitmap") ImageView iv;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindImageBitmap")
22 | public @interface BindImageBitmap {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindImageDrawable.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind image drawable of view . eg: ImageView.
12 | * it will auto set image drawable when you change image drawable from proxy.
13 | *
14 | * {@literal @}BindImageDrawable("imageDrawable") ImageView iv;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindImageDrawable")
22 | public @interface BindImageDrawable {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindImageRes.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind image resource of view . eg: ImageView.
12 | * it will auto set image resource when you change image resource from proxy.
13 | *
14 | * {@literal @}BindImageRes("imageRes") ImageView iv;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindImageRes")
22 | public @interface BindImageRes {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindImageUri.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind image uri({android.net.Uri}) of view . eg: ImageView.
12 | * it will auto set image uri when you change image uri from proxy.
13 | *
14 | * {@literal @}BindImageUri("imageUri") ImageView iv;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindImageUri")
22 | public @interface BindImageUri {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindImageUrl.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind image link url of view . eg: ImageView.
12 | * it will auto set image from url when you change image url from proxy.
13 | *
14 | * {@literal @}BindImageUrl("url") ImageView iv;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod(value = "bindImageUrl", paramTypes = { String.class, Object.class, Object.class })
22 | public @interface BindImageUrl {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindMethodSupplierClass.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 |
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * the bind method supplier class. which supplier the method parameter types of {@linkplain BindAny} or {@linkplain BindsAny}.
11 | * It must be used in conjunction with {@linkplain BindAny} or {@linkplain BindsAny} and self Binder.
12 | * @since 1.2.1
13 | */
14 | @Retention(RetentionPolicy.CLASS)
15 | @Target(ElementType.TYPE)
16 | public @interface BindMethodSupplierClass {
17 |
18 | /**
19 | * the bind method parameter type supplier. see 'com.heaven7.java.data.mediator.BindMethodSupplier'.
20 | * @return the child class which implements 'com.heaven7.java.data.mediator.BindMethodSupplier'.
21 | */
22 | Class> value();
23 | }
24 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindText.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind text of view . eg: TextView.
12 | * it will auto set text when you change text from proxy.
13 | *
14 | * {@literal @}BindText("text") TextView title;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindText")
22 | public @interface BindText {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindTextColor.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind text color of view . eg: TextView.
12 | * it will auto set text color when you change text color from proxy.
13 | *
14 | * {@literal @}BindTextColor("textColor") TextView title;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindTextColor")
22 | public @interface BindTextColor {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindTextColorRes.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind text color resource of view . eg: TextView.
12 | * it will auto set text color resource when you change text color resource from proxy.
13 | *
14 | * {@literal @}BindTextColorRes("textColorRes") TextView title;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindTextColorRes")
22 | public @interface BindTextColorRes {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindTextGravity.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * Created by heaven7 on 2017/11/16.
12 | * @since 1.2.1
13 | */
14 | @Retention(RetentionPolicy.CLASS)
15 | @Target(ElementType.FIELD)
16 | @BindMethod("bindTextGravity")
17 | public @interface BindTextGravity {
18 |
19 | /**
20 | * the property name which will be used to bind object.
21 | * @return the property name
22 | */
23 | String value();
24 |
25 | /**
26 | * the object index. which used for bind multi objects .
27 | * @return the object index.
28 | */
29 | int index() default 0;
30 | }
31 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindTextRes.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind text resource of view . eg: TextView.
12 | * it will auto set text resource when you change text resource from proxy.
13 | *
14 | * {@literal @}BindTextRes("textRes") TextView title;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindTextRes")
22 | public @interface BindTextRes {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindTextSize.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind text size of view . eg: TextView.
12 | * it will auto set text size when you change text size from proxy.
13 | *
14 | * {@literal @}BindTextSize("textSize") TextView title;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindTextSize")
22 | public @interface BindTextSize {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindTextSizePx.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind text size (dip value) of view . eg: TextView.
12 | * it will auto set text size as pix when you change text size from proxy.
13 | *
14 | * {@literal @}BindTextSizePx("textSizePx") TextView title;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindTextSizePx")
22 | public @interface BindTextSizePx {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindTextSizeRes.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind text size resource of view . eg: TextView.
12 | * it will auto set text size resource when you change text size resource from proxy.
13 | *
14 | * {@literal @}BindTextSizeRes("textSizeRes") TextView title;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod("bindTextSizeRes")
22 | public @interface BindTextSizeRes {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * the object index. which used for bind multi objects .
32 | * @return the object index.
33 | */
34 | int index() default 0;
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindVisibility.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import com.heaven7.java.data.mediator.internal.BindMethod;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * bind view visibility.
12 | * it will auto set Visibility when you change visibility from proxy.
13 | *
14 | * {@literal @}BindVisibility("visible") TextView title;
15 | *
16 | * @author heaven7
17 | * @since 1.2.0
18 | */
19 | @Retention(RetentionPolicy.CLASS)
20 | @Target(ElementType.FIELD)
21 | @BindMethod(value = "bindVisibility", paramTypes = {String.class, Object.class, boolean.class})
22 | public @interface BindVisibility {
23 |
24 | /**
25 | * the property name which will be used to bind object.
26 | * @return the property name
27 | */
28 | String value();
29 |
30 | /**
31 | * force use the visibility as boolean or not. default is true.
32 | * @return true if the value type of visibility is boolean.
33 | */
34 | boolean forceAsBoolean() default true;
35 | /**
36 | * the object index. which used for bind multi objects .
37 | * @return the object index.
38 | */
39 | int index() default 0;
40 | }
41 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BinderClass.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * define the binder class.
10 | * it will auto create binder when you using data-binding of data-mediator.
11 | *
12 | * {@literal @}BinderClass(AndroidBinder.class) public class MainActivity extends BaseActivity{ ...}
13 | *
14 | * Created by heaven7 on 2017/11/5.
15 | * @since 1.2.0
16 | */
17 | @Retention(RetentionPolicy.CLASS)
18 | @Target(ElementType.TYPE)
19 | public @interface BinderClass {
20 |
21 | /**
22 | * get tne binder class. see 'com.heaven7.java.data.mediator.Binder' for more info.
23 | * @return the binder class.
24 | */
25 | Class> value();
26 | }
27 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BinderFactoryClass.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * define the binder factory class.
10 | * it will auto create BinderFactory and create Binder when you using data-binding of data-mediator.
11 | *
12 | * {@literal @}BinderFactoryClass(SimpleBinderFactory.class) public class MainActivity extends BaseActivity{ ...}
13 | *
14 | * Created by heaven7 on 2017/11/5.
15 | * @since 1.2.0
16 | */
17 | @Retention(RetentionPolicy.CLASS)
18 | @Target(ElementType.TYPE)
19 | public @interface BinderFactoryClass {
20 |
21 | /**
22 | * get the binder factory class. see 'com.heaven7.java.data.mediator.BinderFactory' for more info.
23 | * @return the binder factory class.
24 | */
25 | Class> value();
26 | }
27 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/bind/BindsAny.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.bind;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * the annotation which can bind an array of properties to any view's array of methods.
10 | * It must be used in conjunction with {@linkplain BindMethodSupplierClass} and self Binder.
11 | *
12 | {@literal @}BindsAny(value = {"prop1", "prop2"}, methods = {"bindAddText1", "bindAddText2"})
13 | TextView mTv_supplier;
14 | *
15 | * Created by heaven7 on 2017/11/16.
16 | * @since 1.2.1
17 | */
18 | @Retention(RetentionPolicy.CLASS)
19 | @Target(ElementType.FIELD)
20 | public @interface BindsAny {
21 | /**
22 | * the property names of data-module which will be used to bind object.
23 | * @return the property name
24 | */
25 | String[] value();
26 |
27 | /**
28 | * the method names of binder
29 | * @return the method supplier classes.
30 | */
31 | String[] methods();
32 |
33 | /**
34 | * the object index. which used for bind multi objects .
35 | * @return the object index.
36 | */
37 | int index() default 0;
38 | }
39 |
--------------------------------------------------------------------------------
/data-mediator-annotations/src/main/java/com/heaven7/java/data/mediator/internal/BindMethod.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.internal;
2 |
3 |
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * define a bind method info of Binder.
11 | * @author heaven7
12 | * @since 1.2.0
13 | */
14 | @Retention(RetentionPolicy.CLASS)
15 | @Target(ElementType.ANNOTATION_TYPE)
16 | public @interface BindMethod {
17 |
18 | /**
19 | * the method name
20 | * @return the method name
21 | */
22 | String value();
23 | /**
24 | * the parameter types
25 | * @return the parameter types
26 | */
27 | Class>[] paramTypes() default { String.class, Object.class };
28 | }
29 |
--------------------------------------------------------------------------------
/data-mediator-compiler/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | *.class
3 | *.log
4 | *.ctxt
5 | .mtj.tmp/
6 | # *.jar
7 | *.war
8 | *.ear
9 | *.zip
10 | *.tar.gz
11 | *.rar
12 | hs_err_pid*
13 | .idea/*/*
14 | .idea/*
15 | .idea/.name
16 | .idea/copyright/
17 | .idea/dictionaries/
18 | .idea/encodings.xml
19 | .idea/workspace.xml
20 | classes/artifacts/data_mediator/
21 | src/test/resources/
22 | out/*
23 |
--------------------------------------------------------------------------------
/data-mediator-compiler/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-compiler/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/data-mediator-compiler/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Aug 28 10:15:54 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/data-mediator-compiler/note/read.txt:
--------------------------------------------------------------------------------
1 |
2 | idea annotation processor
3 | https://stackoverflow.com/questions/19351168/gradle-annotations-flavors-wont-run-annotations-processor?rq=1
4 |
5 |
6 | // may need
7 | *compileJava {
8 | dependsOn generateQueryDSL
9 | source generateQueryDSL.destinationDir
10 | }
11 |
12 | compileGeneratedJava {
13 | dependsOn generateQueryDSL
14 | options.warnings = false
15 | classpath += sourceSets.main.runtimeClasspath
16 | }
17 | task generateQueryDSL(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') {
18 | source = sourceSets.main.java
19 | classpath = configurations.compile //+ configurations.querydslapt
20 | options.compilerArgs = [
21 | "-proc:only",
22 | "-processor", "com.heaven7.java.data.mediator.compiler.MediatorAnnotationProcessor"
23 | ]
24 | destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
25 | }
26 |
--------------------------------------------------------------------------------
/data-mediator-compiler/readme.txt:
--------------------------------------------------------------------------------
1 |
2 | problem:
3 | should copy 'selected' ?
4 |
5 |
6 | multi module depend ? resolve: make all annotation @Retention CLASS.
7 |
8 | design expression evaluate:
9 | https://blog.csdn.net/hunkcai/article/details/6125963
10 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/CodeGeneratorProvider.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler;
2 |
3 | import javax.lang.model.element.Element;
4 |
5 | public interface CodeGeneratorProvider {
6 |
7 | CodeGenerator getCodeGenerator(Element element);
8 | }
9 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/GlobalConfig.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler;
2 |
3 | public class GlobalConfig {
4 |
5 | private static final GlobalConfig sInstance = new GlobalConfig();
6 | //start gson
7 | private double version = 1.0;
8 | private boolean generateJsonAdapter = true;
9 | private boolean disableGson = false;
10 |
11 | public static GlobalConfig getInstance(){
12 | return sInstance;
13 | }
14 |
15 | public double getVersion() {
16 | return version;
17 | }
18 | public void setVersion(double version) {
19 | this.version = version;
20 | }
21 |
22 | public boolean isGenerateJsonAdapter() {
23 | return generateJsonAdapter;
24 | }
25 |
26 | public void setGenerateJsonAdapter(boolean generateJsonAdapter) {
27 | this.generateJsonAdapter = generateJsonAdapter;
28 | }
29 |
30 | public boolean isDisableGson() {
31 | return disableGson;
32 | }
33 |
34 | public void setDisableGson(boolean disableGson) {
35 | this.disableGson = disableGson;
36 | }
37 |
38 | public boolean isJsonAdapterEnabled(){
39 | if(isDisableGson() || !isGenerateJsonAdapter()){
40 | return false;
41 | }
42 | return true;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/ISuperFieldDelegate.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler;
2 |
3 | import javax.lang.model.element.TypeElement;
4 | import java.util.Set;
5 |
6 | /**
7 | * the super field delegate which is used to get field from super interface that is annotated by
8 | * {@literal @}{@linkplain com.heaven7.java.data.mediator.Fields}.
9 | * Created by heaven7 on 2017/9/14 0014.
10 | */
11 | public interface ISuperFieldDelegate {
12 |
13 | /**
14 | * get dependFields for target type element.
15 | * @param te the current type element which to generate .java file,
16 | * @return the all depend fields.
17 | */
18 | Set getDependFields(TypeElement te);
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/TypeInfo.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler;
2 |
3 | import com.squareup.javapoet.TypeName;
4 |
5 | /**
6 | * Created by heaven7 on 2017/8/30.
7 | */
8 | public class TypeInfo {
9 | TypeName typeName; //type name. may be list .array
10 | String paramName; //parameter name
11 | TypeName simpleTypeName;
12 |
13 | public TypeInfo() {
14 | }
15 | public TypeName getTypeName() {
16 | return typeName;
17 | }
18 | public void setTypeName(TypeName typeName) {
19 | this.typeName = typeName;
20 | }
21 |
22 | public String getParamName() {
23 | return paramName;
24 | }
25 | public void setParamName(String paramName) {
26 | this.paramName = paramName;
27 | }
28 | public TypeName getSimpleTypeNameBoxed() {
29 | return simpleTypeName.box();
30 | }
31 | public TypeName getSimpleTypeName() {
32 | return simpleTypeName;
33 | }
34 | public void setSimpleTypeName(TypeName rawTypeName) {
35 | this.simpleTypeName = rawTypeName;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/databinding/parser/BindAnyParser.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler.databinding.parser;
2 |
3 | import com.heaven7.java.data.mediator.compiler.DataBindingInfo;
4 | import com.heaven7.java.data.mediator.compiler.DataBindingParser;
5 |
6 | import javax.lang.model.element.Element;
7 |
8 | public class BindAnyParser implements FieldAnnotationParser {
9 |
10 | @Override
11 | public boolean parse(Element element, DataBindingParser parser, DataBindingInfo info) {
12 |
13 | return parser.parseBindAny(element, info);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/databinding/parser/BindsAnyParser.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler.databinding.parser;
2 |
3 | import com.heaven7.java.data.mediator.compiler.DataBindingInfo;
4 | import com.heaven7.java.data.mediator.compiler.DataBindingParser;
5 |
6 | import javax.lang.model.element.Element;
7 |
8 | public class BindsAnyParser implements FieldAnnotationParser {
9 | @Override
10 | public boolean parse(Element element, DataBindingParser parser, DataBindingInfo info) {
11 |
12 | return parser.parseBindsAny(element, info);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/databinding/parser/FieldAnnotationParser.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler.databinding.parser;
2 |
3 | import com.heaven7.java.data.mediator.compiler.DataBindingInfo;
4 | import com.heaven7.java.data.mediator.compiler.DataBindingParser;
5 |
6 | import javax.lang.model.element.Element;
7 |
8 | /**
9 | * the field annotation parser.
10 | * @author heaven7
11 | * @since 1.4.0
12 | */
13 | public interface FieldAnnotationParser {
14 | boolean parse(Element element, DataBindingParser parser, DataBindingInfo info);
15 | }
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/databinding/parser/FieldBindParser.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler.databinding.parser;
2 |
3 | import com.heaven7.java.data.mediator.compiler.DataBindingInfo;
4 | import com.heaven7.java.data.mediator.compiler.DataBindingParser;
5 |
6 | import javax.lang.model.element.Element;
7 |
8 | public class FieldBindParser implements FieldAnnotationParser {
9 | @Override
10 | public boolean parse(Element element, DataBindingParser parser, DataBindingInfo info) {
11 | return parser.parseBindProperty(element, info);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/databinding/parser/FieldBindsParser.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler.databinding.parser;
2 |
3 | import com.heaven7.java.data.mediator.compiler.DataBindingInfo;
4 | import com.heaven7.java.data.mediator.compiler.DataBindingParser;
5 |
6 | import javax.lang.model.element.Element;
7 |
8 | public class FieldBindsParser implements FieldAnnotationParser {
9 |
10 | @Override
11 | public boolean parse(Element element, DataBindingParser parser, DataBindingInfo info) {
12 | return parser.parseBindsProperty(element, info);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/module/FamilyDescData.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler.module;
2 |
3 | import com.heaven7.java.data.mediator.compiler.FieldData;
4 |
5 | /**
6 | * the family description data
7 | *
8 | * @author heaven7
9 | * @since 1.4.5
10 | */
11 | public class FamilyDescData {
12 |
13 | private byte type = 1;
14 | private String[] master;
15 | private String[] slave;
16 | private FieldData.TypeCompat connectClass;
17 |
18 | public byte getType() {
19 | return type;
20 | }
21 |
22 | public void setType(byte type) {
23 | this.type = type;
24 | }
25 |
26 | public String[] getMaster() {
27 | return master;
28 | }
29 |
30 | public void setMaster(String[] master) {
31 | this.master = master;
32 | }
33 |
34 | public String[] getSlave() {
35 | return slave;
36 | }
37 |
38 | public void setSlave(String[] slave) {
39 | this.slave = slave;
40 | }
41 |
42 | public FieldData.TypeCompat getConnectClass() {
43 | return connectClass;
44 | }
45 |
46 | public void setConnectClass(FieldData.TypeCompat connectClass) {
47 | this.connectClass = connectClass;
48 | }
49 |
50 | public boolean hasSlave() {
51 | return slave != null && slave.length > 0;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/module/ImportDescData.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler.module;
2 |
3 | import java.util.HashMap;
4 | import java.util.List;
5 |
6 | /**
7 | * @since 1.4.5
8 | */
9 | public class ImportDescData {
10 |
11 | private final HashMap map = new HashMap<>();
12 |
13 | public static ImportDescData of(List names, List cns){
14 | ImportDescData idd = new ImportDescData();
15 | for(int i = 0, size = names.size() ; i < size ; i ++){
16 | idd.map.put(names.get(i), cns.get(i));
17 | }
18 | return idd;
19 | }
20 |
21 | public HashMap getImportDatas(){
22 | return map;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/java/com/heaven7/java/data/mediator/compiler/util/MockTypeMirror.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.compiler.util;
2 |
3 | import javax.lang.model.element.AnnotationMirror;
4 | import javax.lang.model.type.TypeKind;
5 | import javax.lang.model.type.TypeMirror;
6 | import javax.lang.model.type.TypeVisitor;
7 | import java.lang.annotation.Annotation;
8 | import java.util.List;
9 |
10 | public class MockTypeMirror implements TypeMirror {
11 |
12 | private final String typeName;
13 |
14 | public MockTypeMirror(String typeName) {
15 | this.typeName = typeName;
16 | }
17 |
18 | @Override
19 | public TypeKind getKind() {
20 | return TypeKind.DECLARED;
21 | }
22 |
23 | @Override
24 | public R accept(TypeVisitor v, P p) {
25 | return null;
26 | }
27 |
28 | public List extends AnnotationMirror> getAnnotationMirrors() {
29 | return null;
30 | }
31 |
32 | public A getAnnotation(Class annotationType) {
33 | return null;
34 | }
35 |
36 | public A[] getAnnotationsByType(Class annotationType) {
37 | return null;
38 | }
39 |
40 | @Override
41 | public String toString() {
42 | return typeName;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/main/resources/META-INF/services/javax.annotation.processing.Processor:
--------------------------------------------------------------------------------
1 | com.heaven7.java.data.mediator.compiler.MediatorAnnotationProcessor
2 | com.heaven7.java.data.mediator.compiler.DataBindingAnnotationProcessor
3 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/test/java/com/heaven7/java/data/mediator/test/FlowItem.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | import com.heaven7.java.data.mediator.Field;
4 | import com.heaven7.java.data.mediator.Fields;
5 | /**
6 | * the item of flow
7 | * Created by heaven7 on 2017/10/8.
8 | */
9 |
10 | /*@Fields({
11 | @Field(propName = "id", type = int.class, since = 1.2, until = 2.0),
12 | @Field(propName = "name" ),
13 | @Field(propName = "desc" ),
14 | })*/
15 | public interface FlowItem{
16 | }
17 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/test/java/com/heaven7/java/data/mediator/test/GetterSetterExample.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | import lombok.AccessLevel;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 |
7 | public class GetterSetterExample {
8 | /**
9 | * Age of the person. Water is wet.
10 | *
11 | * @param age New value for this person's age. Sky is blue.
12 | * @return The current value of this person's age. Circles are round.
13 | */
14 | @Getter
15 | @Setter
16 | private int age = 10;
17 |
18 | /**
19 | * Name of the person.
20 | * -- SETTER --
21 | * Changes the name of this person.
22 | *
23 | * @param name The new value.
24 | */
25 | @Setter(AccessLevel.PROTECTED) private String name;
26 | }
--------------------------------------------------------------------------------
/data-mediator-compiler/src/test/java/com/heaven7/java/data/mediator/test/ISelectable.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | public interface ISelectable {
4 |
5 | int SELECT_MODE_SINGLE = 1;
6 | int SELECT_MODE_MULTI = 2;
7 |
8 | int INVALID_POSITION = -1;
9 |
10 | void setSelected(boolean selected);
11 | boolean isSelected();
12 | }
13 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/test/java/com/heaven7/java/data/mediator/test/IStudent.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | import com.heaven7.java.base.util.SparseArray;
4 | import com.heaven7.java.data.mediator.*;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by Administrator on 2017/9/13 0013.
10 | */
11 | public interface IStudent extends ICopyable, IResetable, IShareable, ISnapable, ISelectable{
12 | int getAge();
13 |
14 | void setAge(int age);
15 |
16 | String getName();
17 |
18 | void setName(String name);
19 |
20 | String getId();
21 |
22 | void setId(String id);
23 |
24 | void setTags(List tags);
25 | List getTags();
26 | ListPropertyEditor beginTagsEditor();
27 | //SparseArray;
28 |
29 | void setCityData(SparseArray sa);
30 | SparseArray getCityData();
31 | SparseArrayPropertyEditor beginCityDataEditor();
32 | }
33 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/test/java/com/heaven7/java/data/mediator/test/MediatorSharedProperties.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | import com.heaven7.java.data.mediator.Property;
4 |
5 | import java.util.HashMap;
6 |
7 | /**
8 | * Created by heaven7 on 2017/9/14 0014.
9 | */
10 | public class MediatorSharedProperties {
11 |
12 | private static final HashMap sCache;
13 |
14 | static{
15 | sCache = new HashMap<>();
16 | putToCache("java.lang.String", "name", 0);
17 | putToCache("xxx", "xxx", 0);
18 | }
19 |
20 | public static Property get(String typeName, String propName, int complexFlag){
21 | return sCache.get(generateKey(typeName, propName, complexFlag));
22 | }
23 |
24 | private static void putToCache(String typeName, String propName, int complexFlag){
25 | sCache.put(generateKey(typeName, propName, complexFlag), new Property(typeName, propName, complexFlag));
26 | }
27 | private static String generateKey(String typeName, String propName, int complexFlag){
28 | return typeName.hashCode() + "_" + propName + "_" + complexFlag;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/test/java/com/heaven7/java/data/mediator/test/NormalTest.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by heaven7 on 2017/9/16.
8 | */
9 | public class NormalTest {
10 |
11 | public static void main(String[] args){
12 | List super StudentModuleImpl> list = new ArrayList<>();
13 | list.add(new StudentModuleImpl());
14 |
15 | List list3 = (List) list;
16 | list3.get(0).setName("455556456");
17 |
18 | //list.removeAll(list3);
19 | // list.addAll(StudentModuleImpl);
20 | //省,市, 区,学校,年级,班级。
21 |
22 | // 对象: 外教,学生。 班级?
23 | // 房间: 房间号, 开始时间-预计结束时间-实际结束时间。 课程类型,状态(进行中.未开始,已结束)
24 | // 同一个老师, 助教,学生不能在多个房间。(修改--)
25 |
26 | log(Math.E);
27 | log(Math.exp(1));
28 |
29 | Object f = 0f;
30 | log(f.getClass().getName());
31 | f = 0d;
32 | log(f.getClass().getName());
33 |
34 | String fullName = "com.heaven7.Outter.Inner";
35 | String packageName = "com.heaven7";
36 | final String interfaceName = fullName.substring(packageName.length() + 1);
37 | log(interfaceName);
38 | }
39 |
40 | private static void log (Object obj){
41 | System.out.println(obj);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/data-mediator-compiler/src/test/java/com/heaven7/java/data/mediator/test/TestLombok.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | import org.junit.Test;
4 |
5 | public class TestLombok {
6 |
7 | @Test
8 | public void test(){
9 | GetterSetterExample example = new GetterSetterExample();
10 | //example.setAge(20);
11 | }
12 |
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/data-mediator-convertor-intellij-plugin/src/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/data-mediator-convertor-intellij-plugin/src/com/heaven7/plugin/data/mediator/convertor/ClassInfo.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.plugin.data.mediator.convertor;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | public class ClassInfo {
7 |
8 | private final List propertyInfos = new ArrayList<>();
9 | private List interfaces;
10 |
11 | public List getPropertyInfos() {
12 | return propertyInfos;
13 | }
14 | public List getInterfaces() {
15 | return interfaces;
16 | }
17 | public void addPropertyInfo(PropertyInfo info) {
18 | this.propertyInfos.add(info);
19 | }
20 |
21 | public void addInterface(String interfaceName){
22 | if(interfaceName == null){
23 | return;
24 | }
25 | if(interfaces == null){
26 | interfaces = new ArrayList<>();
27 | }
28 | interfaces.add(interfaceName);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/data-mediator-convertor-intellij-plugin/src/com/heaven7/plugin/data/mediator/convertor/Util.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.plugin.data.mediator.convertor;
2 |
3 |
4 | public class Util {
5 |
6 | static void checkArgument(boolean condition, String format, Object... args) {
7 | if (!condition) throw new IllegalArgumentException(String.format(format, args));
8 | }
9 |
10 | public static void logError(Object... objs) {
11 | log(true, objs);
12 | }
13 | public static void log(Object... objs) {
14 | log(false, objs);
15 | }
16 | private static void log(boolean error, Object... objs) {
17 | StringBuilder sb = new StringBuilder();
18 | if (objs != null) {
19 | for (Object obj : objs) {
20 | sb.append(obj != null ? obj.toString() : null);
21 | sb.append("\r\n");
22 | }
23 | }
24 | if (error) {
25 | System.err.print(sb.toString());
26 | } else {
27 | System.out.print(sb.toString());
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/data-mediator-intellij-plugin/resources/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/data-mediator-intellij-plugin/src/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/data-mediator-intellij-plugin/src/com/heaven7/plugin/idea/data_mediator/ITypeInterfaceExtend.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.plugin.idea.data_mediator;
2 |
3 | import com.intellij.psi.PsiClass;
4 | import com.intellij.psi.PsiElementFactory;
5 | import com.intellij.psi.codeStyle.JavaCodeStyleManager;
6 |
7 | public interface ITypeInterfaceExtend {
8 |
9 | boolean isSuperClassHas(PsiClass type);
10 |
11 | void makeInterfaceExtend(PsiClass mClass, PsiElementFactory elementFactory, JavaCodeStyleManager styleManager);
12 | }
13 |
--------------------------------------------------------------------------------
/data-mediator-lint/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/java/heaven7/data_mediator_lint/MainActivity.java:
--------------------------------------------------------------------------------
1 | package heaven7.data_mediator_lint;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #8c8c93
8 | #0064ff
9 |
10 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 15sp
5 | 20sp
6 | 25sp
7 | 30sp
8 | 35sp
9 |
10 | 20dp
11 | 30dp
12 |
13 |
14 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | data-binding-test
3 |
4 | Google one
5 | Google two
6 | Google three
7 | Google four
8 | Google five
9 |
10 |
--------------------------------------------------------------------------------
/data-mediator-lint/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/data-mediator-lint/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | gradlePluginVersion = '3.0.0'
6 | lintVersion = '26.0.0-beta2'
7 | }
8 |
9 | repositories {
10 | google()
11 | jcenter()
12 | }
13 | dependencies {
14 | classpath "com.android.tools.build:gradle:$gradlePluginVersion"
15 |
16 | // NOTE: Do not place your application dependencies here; they belong
17 | // in the individual module build.gradle files
18 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
19 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
20 | }
21 | }
22 |
23 | allprojects {
24 | repositories {
25 | google()
26 | jcenter()
27 | }
28 | tasks.withType(Javadoc) {
29 | options.addStringOption('Xdoclint:none', '-quiet')
30 | options.addStringOption('encoding', 'UTF-8')
31 | }
32 | }
33 |
34 | task clean(type: Delete) {
35 | delete rootProject.buildDir
36 | }
37 |
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint-core/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint-core/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_PACKAGING=jar
2 |
3 | #bintrayRepo= maven
4 | # Has to be same as your library module name
5 | #bintrayName= dmchecks
6 |
7 | #publishedGroupId=com.heaven7.java.data.mediator.lint.core
8 | #libraryName= dmchecks
9 | #artifact= dmchecks
10 |
11 | #libraryDescription= 'support data-mediator lint on android.'
12 |
13 | #Your github repo link
14 | #siteUrl= 'https://github.com/LightSun/data-mediator'
15 | #gitUrl= 'https://github.com/LightSun/data-mediator.git'
16 | #githubRepository= 'LightSun/data-mediator'
17 |
18 | #libraryVersion = 1.0
19 |
20 | #developerId= 'heaven7'
21 | #developerName= 'heaven7'
22 | #developerEmail= 'donshine723@gmail.com'
23 |
24 | #licenseName= 'The Apache Software License, Version 2.0'
25 | #licenseUrl= 'http://www.apache.org/licenses/LICENSE-2.0.txt'
26 | #allLicenses= ["Apache-2.0"]
27 |
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint-core/installv1.gradle:
--------------------------------------------------------------------------------
1 | //apply plugin: 'com.github.dcendents.android-maven'
2 | apply plugin: 'maven'
3 |
4 | install {
5 | repositories.mavenInstaller {
6 | pom.groupId = publishedGroupId
7 | pom.artifactId = artifact
8 | pom.version = libraryVersion
9 |
10 | pom.project {
11 | name artifact
12 | packaging POM_PACKAGING
13 | description libraryDescription
14 | url siteUrl
15 |
16 | scm {
17 | url siteUrl
18 | connection gitUrl
19 | developerConnection gitUrl
20 | }
21 |
22 | licenses {
23 | license {
24 | name licenseName
25 | url licenseUrl
26 | }
27 | }
28 |
29 | developers {
30 | developer {
31 | id developerId
32 | name developerName
33 | email developerEmail
34 | }
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint-core/src/main/java/com/heaven7/java/data/mediator/lint/PropertyIssueRegistry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.heaven7.java.data.mediator.lint;
17 |
18 | import com.android.tools.lint.client.api.IssueRegistry;
19 | import com.android.tools.lint.detector.api.Issue;
20 |
21 | import java.util.Collections;
22 | import java.util.List;
23 |
24 | /*
25 | * The list of issues that will be checked when running lint
.
26 | */
27 | public class PropertyIssueRegistry extends IssueRegistry {
28 | @Override
29 | public List getIssues() {
30 | return Collections.singletonList(PropertyDetector.ISSUE_PROP);
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/FlowItem.java.txt:
--------------------------------------------------------------------------------
1 | package dm.lint.test;
2 |
3 | import com.heaven7.java.data.mediator.DataPools;
4 | import com.heaven7.java.data.mediator.Field;
5 | import com.heaven7.java.data.mediator.FieldFlags;
6 | import com.heaven7.java.data.mediator.Fields;
7 | import com.heaven7.java.data.mediator.ListPropertyEditor;
8 | import com.heaven7.java.data.mediator.Property;
9 | import com.heaven7.java.data.mediator.internal.SharedProperties;
10 |
11 | import java.util.List;
12 |
13 | @Fields(value = {
14 | @Field(propName = "desc" , complexType = FieldFlags.COMPLEX_LIST),
15 | })
16 | public interface FlowItem extends DataPools.Poolable {
17 |
18 | Property PROP_desc = SharedProperties.get(String.class.getName(), "desc", 2);
19 |
20 | FlowItem setDesc(List desc1);
21 |
22 | List getDesc();
23 |
24 | ListPropertyEditor extends FlowItem, String> beginDescEditor();
25 |
26 | void getxxx();
27 |
28 | }
29 |
30 |
31 |
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/Java-base-1.1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/Java-base-1.1.0.jar
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/data-mediator-1.4.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/data-mediator-1.4.4.jar
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/data-mediator-annotations-1.2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/data-mediator-annotations-1.2.2.jar
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/data-mediator-lint/dmlint/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/data-mediator-lint/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/data-mediator-lint/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-lint/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/data-mediator-lint/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Nov 29 11:12:36 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/data-mediator-lint/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app',
2 | ':dmlint-core',
3 | ':dmlint'
4 |
--------------------------------------------------------------------------------
/data-mediator-support-gson/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator-support-gson/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/data-mediator-support-gson/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Oct 13 10:02:09 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/data-mediator-support-gson/note/test.txt:
--------------------------------------------------------------------------------
1 | {"list":[{"mark":"AUDI","model":2014,"type":"DIESEL","maker":"AUDI GERMANY","cost":0.0,"colors":["GREY","BLACK","WHITE"]},{"mark":"AUDI","model":2014,"type":"DIESEL","maker":"AUDI GERMANY","cost":121.0,"colors":["GREY","BLACK","WHITE"]},{"mark":"AUDI","model":2014,"type":"DIESEL","maker":"AUDI GERMANY","cost":242.0,"colors":["GREY","BLACK","WHITE"]}],"carsArr":[{"mark":"AUDI","model":2014,"type":"DIESEL","maker":"AUDI GERMANY","cost":0.0,"colors":["GREY","BLACK","WHITE"]},{"mark":"AUDI","model":2014,"type":"DIESEL","maker":"AUDI GERMANY","cost":121.0,"colors":["GREY","BLACK","WHITE"]},{"mark":"AUDI","model":2014,"type":"DIESEL","maker":"AUDI GERMANY","cost":242.0,"colors":["GREY","BLACK","WHITE"]}],"carMap":{"2":{"mark":"AUDI","model":2014,"type":"DIESEL","maker":"AUDI GERMANY","cost":242.0,"colors":["GREY","BLACK","WHITE"]},"1":{"mark":"AUDI","model":2014,"type":"DIESEL","maker":"AUDI GERMANY","cost":121.0,"colors":["GREY","BLACK","WHITE"]},"0":{"mark":"AUDI","model":2014,"type":"DIESEL","maker":"AUDI GERMANY","cost":0.0,"colors":["GREY","BLACK","WHITE"]}}}
2 |
--------------------------------------------------------------------------------
/data-mediator-support-gson/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'data-mediator-support-gson'
2 |
3 |
--------------------------------------------------------------------------------
/data-mediator-support-gson/src/test/java/com/heaven7/java/data/mediator/support/test/ISelectable.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.support.test;
2 |
3 | public interface ISelectable {
4 |
5 | int SELECT_MODE_SINGLE = 1;
6 | int SELECT_MODE_MULTI = 2;
7 |
8 | int INVALID_POSITION = -1;
9 |
10 | void setSelected(boolean selected);
11 | boolean isSelected();
12 | }
13 |
--------------------------------------------------------------------------------
/data-mediator-support-gson/src/test/java/com/heaven7/java/data/mediator/support/test/IStudent.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.support.test;
2 |
3 |
4 | import java.util.List;
5 |
6 | /**
7 | * Created by Administrator on 2017/9/13 0013.
8 | */
9 | public interface IStudent{
10 | int getAge();
11 |
12 | void setAge(int age);
13 |
14 | String getName();
15 |
16 | void setName(String name);
17 |
18 | String getId();
19 |
20 | void setId(String id);
21 |
22 | void setTags(List tags);
23 | List getTags();
24 | }
25 |
--------------------------------------------------------------------------------
/data-mediator-support-gson/src/test/java/com/heaven7/java/data/mediator/support/test/ListCar3TypeAdapter.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.support.test;
2 |
3 |
4 | import com.google.gson.TypeAdapter;
5 | import com.google.gson.stream.JsonReader;
6 | import com.google.gson.stream.JsonWriter;
7 | import com.heaven7.java.data.mediator.support.gson.Car3;
8 |
9 | import java.io.IOException;
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class ListCar3TypeAdapter extends TypeAdapter> {
14 |
15 | private Car3TypeAdapter mAdapter = new Car3TypeAdapter();
16 |
17 | @Override
18 | public void write(JsonWriter out, List value) throws IOException {
19 | out.beginArray();
20 | for(Car3 car3 : value){
21 | mAdapter.write(out, car3);
22 | }
23 | out.endArray();
24 | }
25 |
26 | @Override
27 | public List read(JsonReader in) throws IOException {
28 | List list = new ArrayList<>();
29 | in.beginArray();
30 | while (in.hasNext()){
31 | switch (in.peek()){
32 | case BEGIN_OBJECT:
33 | // log("BEGIN_OBJECT");
34 | list.add(mAdapter.read(in));
35 | break;
36 | }
37 | }
38 | in.endArray();
39 | return list;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/data-mediator-support-gson/src/test/java/com/heaven7/java/data/mediator/support/test/StringArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.support.test;
2 |
3 | import com.google.gson.TypeAdapter;
4 | import com.google.gson.stream.JsonReader;
5 | import com.google.gson.stream.JsonWriter;
6 |
7 | import java.io.IOException;
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | public class StringArrayAdapter extends TypeAdapter>{
12 |
13 | @Override
14 | public void write(JsonWriter out, List value) throws IOException {
15 | out.beginArray();
16 | for(String str : value){
17 | out.value(str);
18 | }
19 | out.endArray();
20 | }
21 |
22 | @Override
23 | public List read(JsonReader in) throws IOException {
24 | return readStringArray(in);
25 | }
26 |
27 | public List readStringArray(JsonReader reader) throws IOException {
28 | List colors = new ArrayList();
29 | reader.beginArray();
30 | while (reader.hasNext()) {
31 | colors.add(reader.nextString());
32 | }
33 | reader.endArray();
34 | return colors;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/data-mediator-support-gson/src/test/java/com/heaven7/java/data/mediator/support/test/StudentTypeAdapter.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.support.test;
2 |
3 | import com.google.gson.TypeAdapter;
4 | import com.google.gson.stream.JsonReader;
5 | import com.google.gson.stream.JsonWriter;
6 |
7 | import java.io.IOException;
8 |
9 | public class StudentTypeAdapter extends TypeAdapter {
10 | @Override
11 | public void write(JsonWriter out, IStudent value) throws IOException {
12 | GsonTest.log("write");
13 | out.beginObject();
14 | out.name("name").value("heaven7");
15 | out.name("id").value("26");
16 | out.endObject();
17 | }
18 | @Override
19 | public IStudent read(JsonReader in) throws IOException {
20 | GsonTest.log("read");
21 | StudentModuleImpl module = new StudentModuleImpl();
22 | in.beginObject();
23 | while (in.hasNext()){
24 | switch (in.nextName()){
25 | case "name":
26 | module.setName(in.nextString());
27 | break;
28 |
29 | case "id":
30 | module.setId(in.nextString());
31 | break;
32 |
33 | default:
34 | in.skipValue();
35 | }
36 | }
37 | in.endObject();
38 | return module;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/data-mediator/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/data-mediator/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | *.class
3 | *.log
4 | *.ctxt
5 | .mtj.tmp/
6 | #*.jar
7 | *.war
8 | *.ear
9 | *.zip
10 | *.tar.gz
11 | *.rar
12 | hs_err_pid*
13 | .idea/*/*
14 | .idea/*
15 | .idea/.name
16 | .idea/copyright/
17 | .idea/dictionaries/
18 | .idea/encodings.xml
19 | .idea/workspace.xml
20 | classes/artifacts/data_mediator/
21 | src/test/resources/
22 |
--------------------------------------------------------------------------------
/data-mediator/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | data-mediator
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.springsource.ide.eclipse.gradle.core.nature
16 | org.eclipse.jdt.core.javanature
17 |
18 |
19 |
--------------------------------------------------------------------------------
/data-mediator/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs:
--------------------------------------------------------------------------------
1 | #org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences
2 | #Mon Aug 28 00:42:29 CST 2017
3 | build.family.org.gradle.tooling.model.eclipse.HierarchicalEclipseProject=;
4 | org.springsource.ide.eclipse.gradle.linkedresources=
5 | org.springsource.ide.eclipse.gradle.rootprojectloc=
6 |
--------------------------------------------------------------------------------
/data-mediator/.settings/gradle/org.springsource.ide.eclipse.gradle.refresh.prefs:
--------------------------------------------------------------------------------
1 | #org.springsource.ide.eclipse.gradle.core.actions.GradleRefreshPreferences
2 | #Mon Aug 28 00:42:22 CST 2017
3 | addResourceFilters=true
4 | afterTasks=afterEclipseImport;
5 | beforeTasks=cleanEclipse;eclipse;
6 | enableAfterTasks=true
7 | enableBeforeTasks=true
8 | useHierarchicalNames=false
9 |
--------------------------------------------------------------------------------
/data-mediator/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/data-mediator/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/data-mediator/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Aug 28 10:15:54 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/data-mediator/note/readme.txt:
--------------------------------------------------------------------------------
1 | 测试需要考虑到各种情况:
2 | 有无, super interfaece, 各种type, 各种flag, 各种接口。 gson.
3 |
4 | next will support map for parceable.
5 |
6 |
7 | javapoet 生成builder
8 | https://github.com/josketres/builderator/blob/master/src/test/java/com/josketres/builderator/BuilderatorTest.java
9 |
10 |
11 | javax.lang.module Elements 等之类的封装。参考项目: juzu
12 |
13 |
14 | 数据初始化?
15 | 扩展接口?
16 | 数据绑定方便的注解?
17 |
18 |
19 | 9.30 target: 1.1.2
20 | 1, list编辑器增加set ok
21 | 2, applyTo dataConsumer ok
22 | 3, batch apply. no need
23 |
24 | 1.1.3
25 | 避免属性冲突 for BaseMediator. ok
26 | prepare SparseArray/map doing (MapPropertyCallback, SparseArrayPropertyCallback, SparseArrayPropertyEditor)
27 | 1.4.1
28 | 1, add beginBatchedDispatches. and endBatchedDispatches for BaseMediator and DataMediator.
29 | 2, data-binding adapter .(support header and footer. support add/remove/change item)
30 | 3, Binder .add bindList method for it which make ItemManager as parameter.
31 | 4, compiler for data-binding support non static inner class.
32 |
33 | deprecated. BaseMediator. android lib
34 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/DataConsumer.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator;
19 |
20 | /**
21 | * the data consumer
22 | * @param the data type
23 | * Created by heaven7 on 2017/9/30 0030.
24 | * @since 1.1.2
25 | */
26 | public interface DataConsumer {
27 |
28 |
29 | /**
30 | * called on process the target data.
31 | * @param data the data
32 | */
33 | void accept(T data);
34 | }
35 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/IBinderSupplier.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator;
19 |
20 | /**
21 | * the binder supplier
22 | * moved to {@linkplain com.heaven7.java.data.mediator.internal.DataMediatorDelegate#createBinder(DataMediator)}
23 | * Created by heaven7 on 2017/9/23.
24 | * @since 1.0.8
25 | */
26 | @Deprecated
27 | public interface IBinderSupplier {
28 |
29 | /**
30 | * create binder by target data mediator.
31 | * @param mediator the data mediator.
32 | * @return the binder.
33 | */
34 | Binder create(DataMediator mediator);
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/ICopyable.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator;
19 |
20 | /**
21 | * indicate the target can be copy.
22 | * @param the data type
23 | * @author heaven7
24 | */
25 | public interface ICopyable {
26 |
27 | /**
28 | * copy the data.
29 | * @return the copied data
30 | */
31 | T copy();
32 |
33 | /**
34 | * copy the data out to the target.
35 | * @param out the out object. it should be the type T.
36 | */
37 | void copyTo(Object out);
38 | }
39 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/IDataMediator.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator;
19 |
20 | import java.io.Serializable;
21 |
22 | /**
23 | * a super interface of 'data-mediator', which extends all our interface of 'data-mediator'(except parceable).
24 | * Created by heaven7 on 2017/9/11 0011.
25 | */
26 | public interface IDataMediator extends Serializable, ICopyable, IResetable, IShareable, ISnapable{
27 | }
28 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/IResetable.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator;
19 |
20 | /**
21 | * an interface that indicate the target object can be reset.
22 | * @author heaven7
23 | */
24 | public interface IResetable {
25 |
26 | /**
27 | * reset the object.
28 | */
29 | void reset();
30 | }
31 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/IShareable.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator;
19 |
20 | /**
21 | * an interface that indicate the object can share some information across some component(eg: android multi activity.).
22 | * and can be clear in future.
23 | * @author heaven7
24 | */
25 | public interface IShareable {
26 |
27 | /**
28 | * clear the share data.
29 | */
30 | void clearShare();
31 | }
32 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/ISnapable.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator;
19 |
20 | /**
21 | * an interface that indicate the object is snapable. and can be clear in future.
22 | * @author heaven7
23 | */
24 | public interface ISnapable {
25 |
26 | /**
27 | * clear the snap data.
28 | */
29 | void clearSnap();
30 | }
31 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/Nameable.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator;
19 |
20 | /**
21 | * indicate some object have name. we can get the name by call {@linkplain Nameable#getName()}.
22 | * @author heaven7
23 | * @since 1.4.4
24 | */
25 | public interface Nameable {
26 |
27 | /**
28 | * get the name
29 | * @return the name
30 | */
31 | String getName();
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/SparseArrayPropertyCallback.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator;
19 |
20 | /**
21 | * the property callback of sparse array.
22 | * @param the module type
23 | * Created by heaven7 on 2017/10/3.
24 | * @since 1.1.3
25 | */
26 | public interface SparseArrayPropertyCallback extends PropertyCallback, MapPropertyCallback{
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/collector/ListPropertyCollector.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator.collector;
19 |
20 | /**
21 | * the list property dispatcher
22 | * @author heaven7
23 | * @since 1.4.4
24 | */
25 | public interface ListPropertyCollector extends PropertyCollector, ListPropertyDispatcher {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/collector/MapPropertyCollector.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator.collector;
19 |
20 |
21 | /**
22 | * the sparse array property dispatcher.
23 | * @author heaven7
24 | * @since 1.4.4
25 | */
26 | public interface MapPropertyCollector extends PropertyCollector , MapPropertyDispatcher{
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/collector/SparseArrayPropertyCollector.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator.collector;
19 |
20 |
21 | /**
22 | * the sparse array property collector
23 | * @author heaven7
24 | * @since 1.4.4
25 | */
26 | public interface SparseArrayPropertyCollector extends MapPropertyCollector {
27 | }
28 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/internal/DataMediatorDelegateImpl.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.internal;
2 |
3 | import com.heaven7.java.base.anno.Hide;
4 | import com.heaven7.java.data.mediator.Binder;
5 | import com.heaven7.java.data.mediator.DataMediator;
6 |
7 | /**
8 | * Created by heaven7 on 2017/10/5.
9 | */
10 | @Hide
11 | /*public*/ class DataMediatorDelegateImpl extends DataMediatorDelegate {
12 | @Override
13 | public Binder createBinder(DataMediator mediator) {
14 | throw new UnsupportedOperationException();
15 | }
16 | @Override
17 | public ParcelDelegate getParcelDelegate(Object parcel) {
18 | throw new UnsupportedOperationException();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/util/EqualsComparator.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017
3 | group of data-mediator
4 | member: heaven7(donshine723@gmail.com)
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 | package com.heaven7.java.data.mediator.util;
19 |
20 | /**
21 | * the equals comparator
22 | * Created by heaven7 on 2017/9/13 0013.
23 | * @since 1.0.2
24 | */
25 | public interface EqualsComparator {
26 |
27 | /**
28 | * called when want to compare the values.
29 | * @param v1 the value one
30 | * @param v2 the value two
31 | * @return true if is equals.
32 | */
33 | boolean isEquals(Object v1, Object v2);
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator/src/main/java/com/heaven7/java/data/mediator/util/PropertyChainInflateException.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.util;
2 |
3 | /**
4 | * indicate inflate the property chain failed as property chain is incorrect.
5 | * @author heaven7
6 | * @since 1.4.4
7 | */
8 | public class PropertyChainInflateException extends RuntimeException {
9 |
10 | public PropertyChainInflateException(String message, Throwable cause) {
11 | super(message, cause);
12 | }
13 | public PropertyChainInflateException(String message) {
14 | super(message);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/Creator.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | public interface Creator {
4 | public T createFromParcel(Parcel source);
5 |
6 | public T[] newArray(int size);
7 | }
8 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/Parcel.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | /**
4 | * Created by heaven7 on 2017/9/7.
5 | */
6 | public class Parcel {
7 | }
8 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/Parcelable.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | /**
4 | * Created by heaven7 on 2017/9/7.
5 | */
6 | public interface Parcelable {
7 |
8 | interface Creator {
9 | T createFromParcel(Parcel source);
10 |
11 | T[] newArray(int size);
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/Proxy.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | public class Proxy {
4 |
5 | public static class Evaluator {
6 |
7 | public static Object evaluate(String expre, Object module, Object value) {
8 | // return T.xxx(expre, mody, val)
9 | return null;
10 | }
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/SimpleTraceAnalyzer.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 | import com.heaven7.java.data.mediator.test.analyse.TraceAnalyzer;
4 | import com.heaven7.java.data.mediator.test.analyse.TraceEvent;
5 |
6 | import java.util.List;
7 |
8 | public class SimpleTraceAnalyzer extends TraceAnalyzer {
9 |
10 | @Override
11 | public void onProcessProperty(Object module, List event) {
12 |
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/SynchronizedTest.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test;
2 |
3 |
4 | /**
5 | * test synchronized.
6 | */
7 | //'javap -sysinfo -v -c com.heaven7.java.data.mediator.test.SynchronizedTest
8 | public class SynchronizedTest {
9 |
10 | private static int sIndex = 0;
11 | private int id;
12 |
13 | public static synchronized void setIndex(int index){
14 | sIndex = index;
15 | }
16 |
17 | public synchronized void setId(int id){
18 | this.id = id;
19 | }
20 |
21 | public void setId2(int id){
22 | synchronized (this) {
23 | this.id = id;
24 | }
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/analyse/MockAnalyse.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.analyse;
2 |
3 | import com.heaven7.java.data.mediator.test.SimpleTraceAnalyzer;
4 | import org.junit.Test;
5 |
6 | public class MockAnalyse {
7 |
8 | TraceManager tm;
9 | TestTarget target;
10 |
11 | // A, B, C, D D, C , B, A
12 | //@Test
13 | public void test1(){
14 | //target.register
15 | tm.register(TestTarget.class, new SimpleTraceAnalyzer());
16 | tm.register("Student", new SimpleTraceAnalyzer());
17 | tm.unregister(TestTarget.class);
18 | tm.unregister("Student");
19 |
20 | tm.beginTrace("your tag");
21 | tm.endTrace("your tag");
22 | //TraceModuleDelegate beginTrace .endTrace.
23 | //- tag = enter -> click dialog evaluate -> tag = EvaluateStart -> click audio -> click option A of subjectXXX -> Evaluate1...
24 | // Async
25 | }
26 |
27 | public static class TestTarget{
28 |
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/analyse/TraceAnalyzer.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.analyse;
2 |
3 |
4 | import java.util.List;
5 |
6 | public abstract class TraceAnalyzer {
7 |
8 | public abstract void onProcessProperty(Object module, List event);
9 |
10 | }
11 |
12 |
13 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/analyse/TraceEvent.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.analyse;
2 |
3 | import com.heaven7.java.data.mediator.Property;
4 |
5 | public class TraceEvent {
6 |
7 | //Object module
8 | private Object oldVal;
9 | private Object newVal;
10 | private Property property;
11 | private int eventType;
12 | private boolean changed;
13 | }
14 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/analyse/TraceManager.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.analyse;
2 |
3 | public interface TraceManager {
4 |
5 | int TRACE_FLAG_PROPERTY_SETTING = 1;
6 | int TRACE_FLAG_PROPERTY_CHANGE = 2;
7 | int TRACE_FLAG_MODULE = 4;
8 |
9 | void register(Class> module, TraceAnalyzer moduleProcessor);
10 | void register(String tag, TraceAnalyzer moduleProcessor);
11 | void register(String[] tags, TraceAnalyzer moduleProcessor);
12 | TraceAnalyzer unregister(Class> module);
13 |
14 | void beginTrace(String your_tag);
15 |
16 | void endTrace(String your_tag);
17 |
18 | void unregister(String your_tag);
19 | }
20 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/BaseTarget.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | //just mock target
4 | public class BaseTarget {
5 |
6 | @BindViewBackground("background")
7 | int mtv;
8 | }
9 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/BindDouble.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Created by heaven7 on 2017/9/21 0021.
10 | */
11 | @Target(ElementType.FIELD)
12 | @Retention(RetentionPolicy.SOURCE)
13 | public @interface BindDouble {
14 |
15 | String value();
16 | }
17 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/BindList.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | /**
4 | * Created by Administrator on 2017/9/21 0021.
5 | */
6 | public @interface BindList {
7 | int id() default 0;
8 | String value();
9 | }
10 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/BindMethod.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 |
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | @Retention(RetentionPolicy.CLASS)
10 | @Target(ElementType.ANNOTATION_TYPE)
11 | public @interface BindMethod {
12 |
13 | String value();
14 |
15 | Class>[] paramTypes();
16 | }
17 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/BindSingle.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Created by heaven7 on 2017/9/21 0021.
10 | */
11 |
12 | @Target(ElementType.FIELD)
13 | @Retention(RetentionPolicy.SOURCE)
14 | public @interface BindSingle {
15 |
16 | int id() default 0;
17 | String value();
18 | }
19 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/BindViewBackground.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * bind view background.
10 | * @author heaven7
11 | * @since 1.1.5
12 | */
13 | @Retention(RetentionPolicy.CLASS)
14 | @Target(ElementType.FIELD)
15 | @BindMethod(value = "bindViewBackground", paramTypes = { String.class, Object.class })
16 | public @interface BindViewBackground {
17 |
18 | /**
19 | * the property name which will be used to bind object.
20 | * @return the property name
21 | */
22 | String value();
23 |
24 | /**
25 | * the object index. which used for bind multi objects .
26 | * @return the object index.
27 | */
28 | int index() default 0;
29 | }
30 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/DataDefine.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Created by Administrator on 2017/9/21 0021.
10 | */
11 |
12 | @Target(ElementType.TYPE)
13 | @Retention(RetentionPolicy.SOURCE)
14 | public @interface DataDefine {
15 |
16 | int id() default 0;
17 | Class> value();
18 | }
19 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/DataMediatorKnife.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | import com.heaven7.java.data.mediator.DataMediator;
4 | import com.heaven7.java.data.mediator.test.copy.IStudent;
5 |
6 | /**
7 | * Created by Administrator on 2017/9/21 0021.
8 | */
9 | public class DataMediatorKnife {
10 |
11 | public static void bind(MockActivity mockActivity, DataMediator mMediator, int id) {
12 |
13 |
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/Define.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | /**
4 | * Created by Administrator on 2017/9/21 0021.
5 | */
6 | public @interface Define {
7 |
8 | DataDefine[] value();
9 | }
10 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/IDataMediatorAdapter.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | /**
4 | * Created by Administrator on 2017/9/21 0021.
5 | */
6 | public interface IDataMediatorAdapter {
7 | }
8 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/MockActivity.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | import com.heaven7.java.data.mediator.DataMediator;
4 | import com.heaven7.java.data.mediator.DataMediatorFactory;
5 | import com.heaven7.java.data.mediator.test.copy.IStudent;
6 |
7 | /**
8 | * Created by heaven7 on 2017/9/21 0021.
9 | */
10 | @Define({
11 | @DataDefine(value = IStudent.class, id = 1),
12 | @DataDefine(value = IStudent.class, id = 2)
13 | })
14 | public class MockActivity {
15 |
16 | @BindSingle(value = "name",id = 1)
17 | int mockTextView;
18 |
19 | @BindSingle(value = "age" ,id = 2)
20 | int mockTextView2;
21 |
22 | @BindList(value = "list.options", id = 1)
23 | int mRv;
24 |
25 | /**
26 | * 根据id匹配不同的对象?
27 | */
28 |
29 | //mock
30 | void onCreate(){
31 | //IStudent should be a module like :IStudentModule
32 | DataMediator mMediator = DataMediatorFactory.createDataMediator(IStudent.class);
33 | DataMediatorKnife.bind(this, mMediator, 1);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/MockDataBind2.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 | public class MockDataBind2 extends Mock_databind {
4 |
5 | public MockDataBind2(T target) {
6 | super(target);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/bind/bindDelegate.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.bind;
2 |
3 |
4 | public interface bindDelegate {
5 |
6 | void unbind();
7 |
8 | void bind(Object data, int index);
9 | }
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/copy/GoodStudent.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.copy;
2 |
3 | /**
4 | * Created by heaven7 on 2017/9/12 0012.
5 | */
6 | public class GoodStudent extends Student implements IGoodStudent{
7 |
8 | private int thinking;
9 |
10 | public int getThinking() {
11 | return thinking;
12 | }
13 | public void setThinking(int thinking) {
14 | this.thinking = thinking;
15 | }
16 |
17 | @Override
18 | public GoodStudent copy() {
19 | GoodStudent gs = new GoodStudent();
20 | copyTo(gs);
21 | return gs;
22 | }
23 |
24 | @Override
25 | public void copyTo(Object out) {
26 | super.copyTo(out);
27 | if(out instanceof IGoodStudent){
28 | IGoodStudent gs = (IGoodStudent) out;
29 | gs.setThinking(getThinking());
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/copy/IGoodStudent.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.copy;
2 |
3 | /**
4 | * Created by heaven7 on 2017/9/13 0013.
5 | */
6 | public interface IGoodStudent {
7 |
8 | int getThinking() ;
9 |
10 | void setThinking(int thinking);
11 | }
12 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/copy/IStudent.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.copy;
2 |
3 | import com.heaven7.java.data.mediator.Property;
4 | import com.heaven7.java.data.mediator.internal.SharedProperties;
5 |
6 | /**
7 | * Created by heaven7 on 2017/9/12 0012.
8 | */
9 | public interface IStudent {
10 |
11 | Property PROP_name = SharedProperties.get(String.class.getName(), "name", 0);
12 |
13 | String getName();
14 |
15 | void setName(String name);
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/copy/Student.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.copy;
2 |
3 | import com.heaven7.java.data.mediator.ICopyable;
4 |
5 | /**
6 | * Created by heaven7 on 2017/9/12 0012.
7 | */
8 |
9 | public class Student implements IStudent, ICopyable {
10 |
11 | private String name ;
12 |
13 | public String getName() {
14 | return name;
15 | }
16 | public void setName(String name) {
17 | this.name = name;
18 | }
19 |
20 | @Override
21 | public IStudent copy() {
22 | Student sdu = new Student();
23 | copyTo(sdu);
24 | return sdu;
25 | }
26 |
27 | @Override
28 | public void copyTo(Object out) {
29 | if(out instanceof IStudent){
30 | ((IStudent)out).setName(this.getName());
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/data/StudentModule.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.data;
2 |
3 | import com.heaven7.java.data.mediator.DataPools;
4 | import com.heaven7.java.data.mediator.Property;
5 | import com.heaven7.java.data.mediator.test.Parcel;
6 | import com.heaven7.java.data.mediator.test.Parcelable;
7 |
8 | import java.io.Serializable;
9 |
10 | public interface StudentModule extends DataPools.Poolable{
11 |
12 | String toString();
13 |
14 | int getAge();
15 |
16 | StudentModule setAge(int age1);
17 |
18 | String getName();
19 |
20 | StudentModule setName(String name1);
21 |
22 | long getId();
23 |
24 | StudentModule setId(long id1);
25 | }
26 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/gdm/TestState.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.gdm;
2 |
3 | import com.heaven7.java.data.mediator.DataPools;
4 | import com.heaven7.java.data.mediator.Property;
5 | import com.heaven7.java.data.mediator.internal.SharedProperties;
6 |
7 | /*@Fields(
8 | value = {
9 | @Field(propName = "state", type = int.class)
10 | },
11 | generateJsonAdapter = false
12 | )*/
13 | public interface TestState extends DataPools.Poolable {
14 | Property PROP_state = SharedProperties.get(int.class.getName(), "state", 0);
15 |
16 | TestState setState(int state1);
17 |
18 | int getState();
19 | }
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/gdm/TestState_$Impl.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.gdm;
2 |
3 | import com.heaven7.java.base.util.Objects;
4 | import com.heaven7.java.data.mediator.DataPools;
5 |
6 | public class TestState_$Impl implements TestState, DataPools.Poolable {
7 | private int state;
8 |
9 | public TestState_$Impl() {
10 | }
11 |
12 | @Override
13 | public void recycle() {
14 | DataPools.recycle(this);
15 | }
16 |
17 | @Override
18 | public void clearProperties() {
19 | this.state = 0;
20 | }
21 |
22 | @Override
23 | public String toString() {
24 | Objects.ToStringHelper helper = Objects.toStringHelper(this)
25 | .add("state", String.valueOf(this.state));
26 | return helper.toString();
27 | }
28 |
29 | public int getState() {
30 | return state;
31 | }
32 |
33 | public TestState setState(int state1) {
34 | this.state = state1;
35 | return this;
36 | }
37 |
38 | @Override
39 | public boolean equals(Object o) {
40 | if (this == o) {
41 | return true;
42 | }
43 | if (!(o instanceof TestState_$Impl)) {
44 | return false;
45 | }
46 | TestState_$Impl that = (TestState_$Impl) o;
47 | if (getState() != that.getState()) {
48 | return false;
49 | }
50 | return true;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/data-mediator/src/test/java/com/heaven7/java/data/mediator/test/jexl/JexlTest.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.java.data.mediator.test.jexl;
2 |
3 | import org.apache.commons.jexl2.Expression;
4 | import org.apache.commons.jexl2.JexlContext;
5 | import org.apache.commons.jexl2.JexlEngine;
6 | import org.apache.commons.jexl2.MapContext;
7 |
8 | public class JexlTest {
9 |
10 | public static void main(String[] args) {
11 | // Create or retrieve an engine
12 | JexlEngine jexl = new JexlEngine();
13 |
14 | // Create an expression
15 | String jexlExp = "Convertor.convert(foo.bar())"; //wrong
16 | Expression e = jexl.createExpression(jexlExp);
17 |
18 | // Create a context and add data
19 | JexlContext jc = new MapContext();
20 | jc.set("foo", new Foo());
21 | jc.set("Convertor","com.heaven7.java.data.mediator.test.jexl.Convertor");
22 |
23 | // Now evaluate the expression, getting the result
24 | Object o = e.evaluate(jc);
25 | System.out.println(0);
26 | }
27 |
28 | public static class Foo {
29 |
30 | public String bar(){
31 | return "Hello Jxel";
32 | }
33 | }
34 |
35 | public static class Convertor {
36 |
37 | public static String convert(String input) {
38 | return input + "__Convertor";
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/dmlint-core/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /.idea
3 | /out
4 | /.gradle
5 |
--------------------------------------------------------------------------------
/dmlint-core/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/dmlint-core/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/dmlint-core/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Dec 01 21:08:57 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/dmlint-core/src/main/java/com/heaven7/java/data/mediator/lint/PropertyIssueRegistry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.heaven7.java.data.mediator.lint;
17 |
18 | import com.android.tools.lint.client.api.IssueRegistry;
19 | import com.android.tools.lint.detector.api.Issue;
20 |
21 | import java.util.Collections;
22 | import java.util.List;
23 |
24 | /*
25 | * The list of issues that will be checked when running lint
.
26 | */
27 | public class PropertyIssueRegistry extends IssueRegistry {
28 | @Override
29 | public List getIssues() {
30 | return Collections.singletonList(PropertyDetector.ISSUE_PROP);
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/FlowItem.java.txt:
--------------------------------------------------------------------------------
1 | package dm.lint.test;
2 |
3 | import com.heaven7.java.data.mediator.DataPools;
4 | import com.heaven7.java.data.mediator.Field;
5 | import com.heaven7.java.data.mediator.FieldFlags;
6 | import com.heaven7.java.data.mediator.Fields;
7 | import com.heaven7.java.data.mediator.ListPropertyEditor;
8 | import com.heaven7.java.data.mediator.Property;
9 | import com.heaven7.java.data.mediator.internal.SharedProperties;
10 |
11 | import java.util.List;
12 |
13 | @Fields(value = {
14 | @Field(propName = "desc" , complexType = FieldFlags.COMPLEX_LIST),
15 | })
16 | public interface FlowItem extends DataPools.Poolable {
17 |
18 | Property PROP_desc = SharedProperties.get(String.class.getName(), "desc", 2);
19 |
20 | FlowItem setDesc(List desc1);
21 |
22 | List getDesc();
23 |
24 | ListPropertyEditor extends FlowItem, String> beginDescEditor();
25 |
26 | void getxxx();
27 |
28 | }
29 |
30 |
31 |
--------------------------------------------------------------------------------
/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/Java-base-1.1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/Java-base-1.1.0.jar
--------------------------------------------------------------------------------
/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/data-mediator-1.4.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/data-mediator-1.4.4.jar
--------------------------------------------------------------------------------
/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/data-mediator-annotations-1.2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/dmlint-core/src/test/resources/com/heaven7/java/data/mediator/lint/data/data-mediator-annotations-1.2.2.jar
--------------------------------------------------------------------------------
/docs/en/FAQ.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/docs/en/FAQ.md
--------------------------------------------------------------------------------
/docs/en/chain_call.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/docs/en/chain_call.md
--------------------------------------------------------------------------------
/docs/en/data_cache.md:
--------------------------------------------------------------------------------
1 | # data cache
2 | * data cache use pool to reuse data
3 | * steps:
4 | * 1), use annotation to indicate pool count ¡£eg:
5 | ```java
6 | @Fields(value = {
7 | @Field(propName = "name", seriaName = "heaven7", type = String.class),
8 | @Field(propName = "data", seriaName = "result", type = ResultData.class),
9 | }, maxPoolCount = 100) //max 100
10 | public interface TestBind extends Parcelable{
11 | }
12 | ```
13 | * 2),how to get data module ? use DataMediatorFactory , eg:
14 | ```java
15 | Student result = DataMediatorFactory.obtain(Student.class);
16 | ```
17 | * 3), how to recycle ? use data entity¡£eg: Student
18 | ```java
19 | DataMediator dm = DataMediatorFactory.obtain(Student.class);;
20 | dm.getData().recycle();
21 | ```
22 | * 4), ps: after recycle you must not use the data again or else may cause some problem you don't want¡£
23 |
24 | * data cache is thread safe? yes , it is.
25 |
--------------------------------------------------------------------------------
/docs/en/listen_property_change.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/docs/en/listen_property_change.md
--------------------------------------------------------------------------------
/docs/zh/advance.md:
--------------------------------------------------------------------------------
1 |
2 | ======================================
3 | ### data-mediator 进阶指南
4 | * [binder-详解](https://github.com/markdown-it/markdown-it) for Markdown parsing
5 | * [数据缓存-详解](https://github.com/markdown-it/markdown-it) for Markdown parsing
6 | * [api 说明](https://github.com/markdown-it/markdown-it) for Markdown parsing
7 |
--------------------------------------------------------------------------------
/docs/zh/data_cache.md:
--------------------------------------------------------------------------------
1 |
2 | ### data-mediator数据缓存详解
3 | * 数据缓存: 使用缓存池,反复利用对象。
4 | * 缓存好处: 在某些大对象数据多的情况下,避免内存抖动和反复gc.
5 | * 使用步骤:
6 | * 1), 用注解标识缓存个数。eg:
7 | ```java
8 | @Fields(value = {
9 | @Field(propName = "name", seriaName = "heaven7", type = String.class),
10 | @Field(propName = "data", seriaName = "result", type = ResultData.class),
11 | }, maxPoolCount = 100) //最多缓存100个
12 | public interface TestBind extends Parcelable{
13 | }
14 | ```
15 | * 2), 如何获取对象? 使用 DataMediatorFactory 获取, eg:
16 | ```java
17 | StudentModule result = DataMediatorFactory.obtain(StudentModule.class);
18 | ```
19 | * 3), 如何回收对象? 使用 生成的实体数据对象。 比如StudentModule
20 | ```java
21 | StudentModule result = ....; //必须是真正的数据。代理层如果调用会报异常.
22 | result.recycle();
23 | ```
24 | * 4), ps: 数据回收之后。请不要再保持引用这个对象,除非重新obtain(因为所有属性将会回归初始状态)。
25 |
26 | * 本框架数据缓存。 线程安全么? 答: 必须线程安全的
27 |
--------------------------------------------------------------------------------
/docs/zh/design_idea.md:
--------------------------------------------------------------------------------
1 | ### 框架解决的问题和思想
2 | * 目前开发的常见问题:
3 | 通常况下我们写app: 需要写很多实体,常用的就是和server交互的实体.在版本不断迭代的情况下,数据模型可能会很很多次(CRUD 字段甚至直接删除整个module).
4 |
即使我们使用parcelable 代码生成器,也经常要ALT+insert去重新生成。toString那些更不用说了。
5 |
而且如果用gson注解映射, 就更不太方便了。
6 |
如果想链式编程....也不方便。
7 |
...
8 |
9 | * data-mediator 数据中介者者框架就是从解决数据模型遇到的问题开始的。
10 |
11 | * 整个设计分3层:
12 | * 从框架/模块来说: 注解层,编译层,调用层
13 | * 从数据模型来说:模型层,代理层,调用层
14 | * 模型层:代表的是数据模型接口and实现
15 | * 代理层:数据模型/实体的代理
16 | * 调用层:操作模型和代理的.
17 |
--------------------------------------------------------------------------------
/docs/zh/scope_desc.md:
--------------------------------------------------------------------------------
1 |
2 | ### 关于域的说明
3 | * 在本框架内, 有很多域。比如toString/hashCode/Equals. 比如域接口 :重置(IResetable接口), 拷贝(ICopyable接口),
4 |
共享(Shareable), 快照(ISnapable)接口。 这些域指的是什么 ?
5 |
答:
6 | * 在这里的意思是 字段(field)的作用域。 比如字段可以选择参加toString或者不参加。 hashCode/equals同理。
7 | * 域的接口也是类似的。域接口的方法。也是类似toString等方法的使用。
8 | * 比如IResetable.的方法 reset() 就是重置那些已有 域标志 FLAG_RESET 的 所有字段。 其他域接口同理.
9 |
10 |
11 | ### 扩展接口(继承这些接口后编译层会自动实现)
12 | * 数据模型支持接口的扩展。但是只支持已知的。
13 |
下面是已知的扩展接口
14 |
15 | ```java
16 | //java和android的序列化
17 | java.io.Serializable
18 | android.os.Parcelable
19 |
20 | //quick adapter库。数据模型作为List结构view的item 需要实现的接口
21 | com.heaven7.adapter.ISelectable
22 | // 如果你希望有些属性支持拷贝 (extends 的时候不要使用泛型,否则还要强转)
23 | com.heaven7.java.data.mediator.ICopyable
24 | // 如果你希望有些属性支持 重置
25 | com.heaven7.java.data.mediator.IResetable
26 | // 如果你希望有些属性支持 共享(比如多个组件共享数据,后面可以通过clearShare去清除这些共享的数据)
27 | com.heaven7.java.data.mediator.IShareable
28 | // 如果你希望有些属性支持 快照。
29 | com.heaven7.java.data.mediator.ISnapable
30 | ```
--------------------------------------------------------------------------------
/output/app-debug.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/output/app-debug.apk
--------------------------------------------------------------------------------
/plugin-data-mediator-test/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | *.class
3 | *.log
4 | *.ctxt
5 | .mtj.tmp/
6 | # *.jar
7 | *.war
8 | *.ear
9 | *.zip
10 | *.tar.gz
11 | *.rar
12 | hs_err_pid*
13 | .build/
14 | .out/
15 | .idea/
16 | .idea/*/*
17 | .idea/*
18 | .idea/.name
19 | .idea/copyright/
20 | .idea/dictionaries/
21 | .idea/encodings.xml
22 | .idea/workspace.xml
23 | classes/artifacts/data_mediator/
24 | src/test/resources/
25 | out/*
26 | generated/*
27 | generated_tests/*
28 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/plugin-data-mediator-test/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/plugin-data-mediator-test/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Oct 23 11:36:58 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'plugin-data-mediator-test'
2 |
3 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/src/main/java/com/heaven7/plugin/idea/data_mediator/test/GsonTest.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.plugin.idea.data_mediator.test;
2 |
3 | import com.heaven7.java.data.mediator.*;
4 | import com.heaven7.java.data.mediator.internal.SharedProperties;
5 |
6 | /**
7 | * Created by heaven7 on 2017/10/29.
8 | */
9 | @Fields({
10 | @Field(propName = "id", seriaName = "_id", since = 1.1, until = 1.5),
11 | @Field(propName = "test", flags = FieldFlags.FLAGS_MAIN_SCOPES_2 &~ FieldFlags.FLAG_GSON_PERSISTENCE)
12 | })
13 | public interface GsonTest extends DataPools.Poolable {
14 |
15 | Property PROP_id = SharedProperties.get(String.class.getName(), "id", 0);
16 | Property PROP_test = SharedProperties.get(String.class.getName(), "test", 0);
17 |
18 | GsonTest setId(String id1);
19 |
20 | String getId();
21 |
22 | GsonTest setTest(String test1);
23 |
24 | String getTest();
25 | }
26 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/src/main/java/com/heaven7/plugin/idea/data_mediator/test/TestGroupProperty.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.plugin.idea.data_mediator.test;
2 |
3 | import com.heaven7.java.data.mediator.*;
4 | import com.heaven7.java.data.mediator.internal.SharedProperties;
5 |
6 | /**
7 | * Created by heaven7 on 2018/6/27.
8 | */
9 | @Fields(value = {
10 | @Field(propName = "state", type = int.class)
11 | }, groups = {
12 | @GroupDesc(prop = "state", focusVal = 1, oppositeVal = -1)
13 | })
14 | public interface TestGroupProperty extends DataPools.Poolable {
15 | Property PROP_state = SharedProperties.get("int", "state", 0);
16 |
17 | TestGroupProperty setState(int state1);
18 |
19 | int getState();/*
20 | ================== start methods from super properties ===============
21 | ======================================================================= */
22 | }
23 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/src/main/java/com/heaven7/plugin/idea/data_mediator/test/convert/Outter.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.plugin.idea.data_mediator.test.convert;
2 |
3 | import com.heaven7.java.data.mediator.Field;
4 | import com.heaven7.java.data.mediator.Fields;
5 | import com.heaven7.java.data.mediator.Property;
6 | import com.heaven7.java.data.mediator.internal.SharedProperties;
7 |
8 | public class Outter {
9 |
10 | public static class Inner{
11 | private String name;
12 | }
13 |
14 | public static class TestInner1 extends Outter2.Inner2_1.Inner2_2{
15 | private String testInner1;
16 | }
17 |
18 | @Fields(value = {@Field(propName = "testInner1")
19 | }, generateJsonAdapter = false)
20 | public interface ITestInner1 extends Outter2.Inner2_1.IInner2_2 {
21 | Property PROP_testInner1 = SharedProperties.get(String.class.getName(), "testInner1", 0);
22 |
23 | ITestInner1 setTestInner1(String testInner11);
24 |
25 | String getTestInner1();/*
26 | ================== start methods from super properties ===============
27 | ======================================================================= */
28 |
29 | ITestInner1 setText(String text1);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/src/main/java/com/heaven7/plugin/idea/data_mediator/test/convert/Outter2.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.plugin.idea.data_mediator.test.convert;
2 |
3 |
4 |
5 | import com.heaven7.java.data.mediator.DataPools;
6 | import com.heaven7.java.data.mediator.Field;
7 | import com.heaven7.java.data.mediator.Fields;
8 | import com.heaven7.java.data.mediator.Property;
9 | import com.heaven7.java.data.mediator.internal.SharedProperties;
10 |
11 | import java.util.ArrayList;
12 |
13 | public class Outter2 {
14 |
15 | public static class Inner2_1 {
16 | //just test
17 | public static class Inner2_2 extends ArrayList{
18 | private String text;
19 | }
20 |
21 | @Fields(value = {@Field(propName = "text")
22 | }, generateJsonAdapter = false)
23 | public interface IInner2_2 extends DataPools.Poolable {
24 | Property PROP_text = SharedProperties.get(String.class.getName(), "text", 0);
25 |
26 | IInner2_2 setText(String text1);
27 |
28 | String getText();
29 | }
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/src/main/java/com/heaven7/plugin/idea/data_mediator/test/convert/Student.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.plugin.idea.data_mediator.test.convert;
2 |
3 | import com.google.gson.annotations.Expose;
4 | import com.google.gson.annotations.SerializedName;
5 | import com.google.gson.annotations.Since;
6 | import com.google.gson.annotations.Until;
7 |
8 | //auto generate the module of 'data-mediator'(自动生成DataMediator 框架 需要的数据模型 )
9 | public class Student {
10 |
11 | private String name;
12 |
13 | @SerializedName("_id")
14 | private String id;
15 |
16 | @Expose
17 | private int age;
18 | @Since(1.3)
19 | private int grade;
20 |
21 | @Since(1.2)
22 | @Until(2.6)
23 | private String nickName;
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/src/main/java/com/heaven7/plugin/idea/data_mediator/test/util/TestUtil.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.plugin.idea.data_mediator.test.util;
2 |
3 | import com.heaven7.plugin.idea.data_mediator.test.Student;
4 | import com.heaven7.plugin.idea.data_mediator.test.TestSelfMethod1;
5 |
6 | /**
7 | * Created by heaven7 on 2017/10/26.
8 | */
9 | public class TestUtil {
10 |
11 | public static int getStudentId(TestSelfMethod1 tsf, Student stu, int key){
12 | //do something you want.
13 | return 0;
14 | }
15 |
16 | public static void parseStudent(TestSelfMethod1 tsf, Student stu, int key){
17 | //do thing.
18 | }
19 |
20 | public static int getStudentId2(TestSelfMethod1 tsf, Student stu,
21 | int key, String test){
22 | //do something you want.
23 | return 0;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/src/main/java/com/heaven7/plugin/idea/data_mediator/test/util/TestUtil2.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.plugin.idea.data_mediator.test.util;
2 |
3 | import com.heaven7.plugin.idea.data_mediator.test.Student;
4 | import com.heaven7.plugin.idea.data_mediator.test.TestSelfMethod2;
5 |
6 | /**
7 | * Created by heaven7 on 2017/10/26.
8 | */
9 | public class TestUtil2 {
10 |
11 | public static int getStudentId2(TestSelfMethod2 tsf, Student stu,
12 | int key){
13 | //do thing.
14 | return 0;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/src/test/java/com/heaven7/test/LogUtils.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.test;
2 |
3 | import java.util.Arrays;
4 |
5 | public class LogUtils {
6 |
7 | public static void log(Object obj){
8 | System.out.println(obj);
9 | }
10 | public static void log(String tag,String method , Object...objs){
11 | System.out.println("TAG = "+ tag + " called [ "+method+"() ]:" + Arrays.toString(objs));
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/src/test/java/com/heaven7/test/TestUtil3.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.test;
2 |
3 | import com.heaven7.plugin.idea.data_mediator.test.Student;
4 | import com.heaven7.test.test_self_method.TestSelfMethod3;
5 |
6 | /**
7 | * Created by heaven7 on 2017/10/26.
8 | */
9 | public class TestUtil3 {
10 |
11 | public static String getStudentId3(TestSelfMethod3 tsf, Student stu,
12 | int key){
13 | //do thing.
14 | return null;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/plugin-data-mediator-test/src/test/java/com/heaven7/test/test_self_method/TestSelfMethod4.java:
--------------------------------------------------------------------------------
1 | package com.heaven7.test.test_self_method;
2 |
3 | import com.heaven7.java.data.mediator.Field;
4 | import com.heaven7.java.data.mediator.Fields;
5 | import com.heaven7.java.data.mediator.Property;
6 | import com.heaven7.java.data.mediator.internal.SharedProperties;
7 | import com.heaven7.plugin.idea.data_mediator.test.Student;
8 |
9 | /**
10 | * Created by heaven7 on 2017/10/26.
11 | */
12 | @Fields({
13 | @Field(propName = "test_self4_1")
14 | })
15 | public interface TestSelfMethod4 extends TestSelfMethod3{
16 |
17 | Property PROP_test_self4_1 = SharedProperties.get(String.class.getName(), "test_self4_1", 0);
18 |
19 | TestSelfMethod4 setTest_self4_1(String test_self4_11);
20 |
21 | String getTest_self4_1();/*
22 | ================== start methods from super properties ===============
23 | ======================================================================= */
24 |
25 | TestSelfMethod4 setTest_1(boolean test_11);
26 |
27 | TestSelfMethod4 setTest_2(String test_21);
28 |
29 | TestSelfMethod4 setId(Student id1);
30 |
31 | TestSelfMethod4 setName(String name1);
32 |
33 | TestSelfMethod4 setTest_self1(String test_self11);
34 |
35 | TestSelfMethod4 setTest_self2(int test_self21);
36 | }
37 |
--------------------------------------------------------------------------------
/res/as_make_project.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/res/as_make_project.png
--------------------------------------------------------------------------------
/res/data-mediator-convertor.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/res/data-mediator-convertor.gif
--------------------------------------------------------------------------------
/res/data-mediator-generator.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/res/data-mediator-generator.gif
--------------------------------------------------------------------------------
/res/data_mediator_base_binder.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/res/data_mediator_base_binder.gif
--------------------------------------------------------------------------------
/res/data_mediator_binder_main.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/res/data_mediator_binder_main.gif
--------------------------------------------------------------------------------
/res/data_mediator_binding_adapter.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/res/data_mediator_binding_adapter.gif
--------------------------------------------------------------------------------
/res/workflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LightSun/data-mediator/4564c3f0266ecf310252a8f68081762734a99c12/res/workflow.png
--------------------------------------------------------------------------------