SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
SimpleModeler
Android     ⾃自 ⽣生
with g3/g4
2011   10⽉月15⽇日
•  Modegramming Style (           DSL
           )
  •  http://modegramming.blogspot.com/
•  SimpleModeler
  •  http://code.google.com/p/simplemodeler/
•  g3
  •  http://code.google.com/p/goldenport3/
•  g4
  •  https://github.com/asami/goldenport-android-library
•  JJUG CCC 2011 Fall
     •  10⽉月17⽇日(⽉月)   ⽴立立                 ⻘青
     •        Scala
     •  http://www.java-users.jp/contents/events/ccc2011fall/
        index.html
     •  http://kokucheese.com/event/index/18473/
•                          (   1   )
     •  10⽉月29⽇日(⼟土)                   (      )
     •  ⽉月
     •  http://atnd.org/events/20884
•  CSV   Android   (&Rest   )   ⽣生
⼊入⼒力力CSV
SimpleModeler     Scala DSL   CSV
                ⼊入⼒力力


 #actor,parts,attrs
 customer,,name;phone;summary
 #resource
 goods,,note
 #event
 buy,customer;goods
g3
g3
class App extends G3Application with UseRecord {
   port("/demo") invoke('ds)
   val schema_customer = Schema(
      AutoIdField,
      ('name, XString),
      ('summary, XString),                          SimpleModeler
      ('phone, XString))                            ⾃自 ⽣生
   val schema_goods = Schema(
      AutoIdField,
      ('name, XString),
      ('summary, XString),
      ('note, XString))
   val schema_buy = Schema(
      AutoIdField,
      ('dateTime, XDateTime),
      ('customer, XEntityReference('customer)),
      ('goods, XEntityReference('goods)))
   datastore('ds, RecordClassSpace(
         RecordClass('customer, schema_customer),
         RecordClass('goods, schema_goods),
         RecordClass('buy, schema_buy)))
}
g4
•  Android                       (Java)
  • 
  •  DI (Dependency Injection)
  • 
  •  ⾮非
•  g4
  • 
  •            (loosely coupled)          (high coherency)
  • 
  • 
  • 
  •                  (testability)
  •  ⾃自   ⽣生           ⽫皿
DI(Dependency Injection)
• 
     •  Spring
     •  Google Guice
     •  RoboGuice
          •  Android⽤用DI
          •  Guice
•                          ⼊入
     • 
     •                          ⽴立立
• 
DI   ⽅方
DI
public class DemoModule extends GModule {
  public DemoModule(GContext context) {
     super(context);
  }

   @Override
   protected void configure() {
     configure_context();
     bind(DemoContext.class).toInstance((DemoContext)gcontext);
     bind(GErrorModel.class).to(DemoErrorModel.class).in
(Singleton.class);
     bind(GModel.class).to(DemoModel.class).in(Singleton.class);
     bind(GAgent.class).to(DemoAgent.class).in(Singleton.class);
     bind(GController.class).to(DemoController.class);
     bind(IDemoRestDriver.class).to(DemoG3Driver.class);
   }
}
DI
public class CustomerRestViewActivity extends
     GActivity<DemoController> {
  @LayoutView(R.id.header)
  TextView mHeader;
  @ResourceString(R.string.header)
  String mHeaderLabel;
  @ResourceColor(R.color.header)
  Color mHeaderColor;
  @IntentExtra("message")
  String mMessage;

    public CustomerRestViewActivity() {
      addTrait(new ListViewTrait());
    }

…
•  Scala⾔言
•  Java



              (Scala)

class MyListActivity extends Activity with ListViewer


class MyMapActivity extends MapActivity with
MyLocationOverlayViewer
⽅方
public class CustomerRestViewActivity extends GActivity<DemoController> {
  @LayoutView(R.id.header)
  TextView mHeader;
  @ResourceString(R.string.header)
  String mHeaderLabel;
  @ResourceColor(R.color.header)
  Color mHeaderColor;
  @IntentExtra("message")
  String mMessage;

    public CustomerRestViewActivity() {
      addTrait(new ListViewTrait());
    }

…
•  DI   ⽬目   Android
•  SimpleModeler
   •                                                  ⾃自 ⽣生
       •                     ⼟土                  ⾃自    ⽣生

  •  CSV       g3           Android               ⽣生

•  g4
   • 
   •  ⾮非
   •  DI (Dependency Injection)
       • 
       •  g4       Guice
  • 
       •                                   ⽴立立
       •  Java⾔言                      g4
END

Contenu connexe

Similaire à SimpleModelerによるAndroidアプリ自動生成 with g3/g4

DevQuiz 2011 の模範解答 Android編
DevQuiz 2011 の模範解答 Android編DevQuiz 2011 の模範解答 Android編
DevQuiz 2011 の模範解答 Android編
Makoto Yamazaki
 

Similaire à SimpleModelerによるAndroidアプリ自動生成 with g3/g4 (20)

Getting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle pluginGetting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle plugin
 
getting-your-groovy-on
getting-your-groovy-ongetting-your-groovy-on
getting-your-groovy-on
 
DevQuiz 2011 の模範解答 Android編
DevQuiz 2011 の模範解答 Android編DevQuiz 2011 の模範解答 Android編
DevQuiz 2011 の模範解答 Android編
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to Swagger
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and Practice
 
Grails 101
Grails 101Grails 101
Grails 101
 
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume LaforgeGroovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
 
Building modular monoliths that could scale to microservices (only if they ne...
Building modular monoliths that could scale to microservices (only if they ne...Building modular monoliths that could scale to microservices (only if they ne...
Building modular monoliths that could scale to microservices (only if they ne...
 
Using Geoscript Groovy
Using Geoscript GroovyUsing Geoscript Groovy
Using Geoscript Groovy
 
#BABBQAmsterdam The other Android getting started guide: Gradle power
#BABBQAmsterdam The other Android getting started guide: Gradle power#BABBQAmsterdam The other Android getting started guide: Gradle power
#BABBQAmsterdam The other Android getting started guide: Gradle power
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
 
Go for Mobile Games
Go for Mobile GamesGo for Mobile Games
Go for Mobile Games
 
Grooscript gr8conf 2015
Grooscript gr8conf 2015Grooscript gr8conf 2015
Grooscript gr8conf 2015
 
Dsl로 만나는 groovy
Dsl로 만나는 groovyDsl로 만나는 groovy
Dsl로 만나는 groovy
 
[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android
 
[UniteKorea2013] Protecting your Android content
[UniteKorea2013] Protecting your Android content[UniteKorea2013] Protecting your Android content
[UniteKorea2013] Protecting your Android content
 
Eric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyondEric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyond
 
Eric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyondEric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyond
 
Building Modular monliths that could scale to microservices (only if they nee...
Building Modular monliths that could scale to microservices (only if they nee...Building Modular monliths that could scale to microservices (only if they nee...
Building Modular monliths that could scale to microservices (only if they nee...
 

Plus de Tomoharu ASAMI

Plus de Tomoharu ASAMI (20)

アプリケーション・アーキテクチャ 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第34回】
アプリケーション・アーキテクチャ 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第34回】アプリケーション・アーキテクチャ 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第34回】
アプリケーション・アーキテクチャ 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第34回】
 
テスト 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第33回】
テスト 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第33回】テスト 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第33回】
テスト 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第33回】
 
実装(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第32回】
実装(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第32回】実装(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第32回】
実装(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第32回】
 
実装(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第31回】
実装(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第31回】実装(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第31回】
実装(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第31回】
 
実装(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第30回】
実装(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第30回】実装(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第30回】
実装(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第30回】
 
設計/UX/UI 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第29回】
設計/UX/UI 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第29回】設計/UX/UI 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第29回】
設計/UX/UI 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第29回】
 
設計/原理 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第28回】
設計/原理 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第28回】設計/原理 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第28回】
設計/原理 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第28回】
 
設計/ドメイン設計(5) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第27回】
設計/ドメイン設計(5) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第27回】設計/ドメイン設計(5) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第27回】
設計/ドメイン設計(5) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第27回】
 
設計/ドメイン設計(4) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第26回】
設計/ドメイン設計(4) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第26回】設計/ドメイン設計(4) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第26回】
設計/ドメイン設計(4) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第26回】
 
設計/ドメイン設計(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第25回】
設計/ドメイン設計(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第25回】設計/ドメイン設計(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第25回】
設計/ドメイン設計(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第25回】
 
設計/ドメイン設計(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第24回】
設計/ドメイン設計(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第24回】設計/ドメイン設計(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第24回】
設計/ドメイン設計(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第24回】
 
設計/ドメイン設計(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第23回】
設計/ドメイン設計(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第23回】設計/ドメイン設計(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第23回】
設計/ドメイン設計(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第23回】
 
設計/コンポーネント設計(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第22回】
設計/コンポーネント設計(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第22回】設計/コンポーネント設計(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第22回】
設計/コンポーネント設計(3) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第22回】
 
設計/コンポーネント設計(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第21回】
設計/コンポーネント設計(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第21回】設計/コンポーネント設計(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第21回】
設計/コンポーネント設計(2) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第21回】
 
設計/コンポーネント設計(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第20回】
設計/コンポーネント設計(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第20回】設計/コンポーネント設計(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第20回】
設計/コンポーネント設計(1) 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第20回】
 
設計/アーキテクチャ設計 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第19回】
設計/アーキテクチャ設計 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第19回】設計/アーキテクチャ設計 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第19回】
設計/アーキテクチャ設計 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第19回】
 
設計 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第18回】
設計 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第18回】設計 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第18回】
設計 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第18回】
 
分析/イベント駆動 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第17回】
分析/イベント駆動 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第17回】分析/イベント駆動 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第17回】
分析/イベント駆動 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第17回】
 
分析/コンポーネント分析 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第16回】
分析/コンポーネント分析 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第16回】分析/コンポーネント分析 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第16回】
分析/コンポーネント分析 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第16回】
 
分析 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第15回】
分析 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第15回】分析 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第15回】
分析 【クラウドアプリケーションのためのオブジェクト指向分析設計講座 第15回】
 

Dernier

Dernier (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

SimpleModelerによるAndroidアプリ自動生成 with g3/g4

  • 1. SimpleModeler Android ⾃自 ⽣生 with g3/g4 2011 10⽉月15⽇日
  • 2.
  • 3. •  Modegramming Style ( DSL ) •  http://modegramming.blogspot.com/ •  SimpleModeler •  http://code.google.com/p/simplemodeler/ •  g3 •  http://code.google.com/p/goldenport3/ •  g4 •  https://github.com/asami/goldenport-android-library
  • 4. •  JJUG CCC 2011 Fall •  10⽉月17⽇日(⽉月)   ⽴立立 ⻘青 •  Scala •  http://www.java-users.jp/contents/events/ccc2011fall/ index.html •  http://kokucheese.com/event/index/18473/ •  ( 1 ) •  10⽉月29⽇日(⼟土) ( ) •  ⽉月 •  http://atnd.org/events/20884
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. •  CSV Android (&Rest ) ⽣生
  • 10. ⼊入⼒力力CSV SimpleModeler Scala DSL CSV ⼊入⼒力力 #actor,parts,attrs customer,,name;phone;summary #resource goods,,note #event buy,customer;goods
  • 11. g3
  • 12. g3 class App extends G3Application with UseRecord { port("/demo") invoke('ds) val schema_customer = Schema( AutoIdField, ('name, XString), ('summary, XString), SimpleModeler ('phone, XString)) ⾃自 ⽣生 val schema_goods = Schema( AutoIdField, ('name, XString), ('summary, XString), ('note, XString)) val schema_buy = Schema( AutoIdField, ('dateTime, XDateTime), ('customer, XEntityReference('customer)), ('goods, XEntityReference('goods))) datastore('ds, RecordClassSpace( RecordClass('customer, schema_customer), RecordClass('goods, schema_goods), RecordClass('buy, schema_buy))) }
  • 13. g4 •  Android (Java) •  •  DI (Dependency Injection) •  •  ⾮非 •  g4 •  •  (loosely coupled) (high coherency) •  •  •  •  (testability) •  ⾃自 ⽣生 ⽫皿
  • 14.
  • 15. DI(Dependency Injection) •  •  Spring •  Google Guice •  RoboGuice •  Android⽤用DI •  Guice •  ⼊入 •  •  ⽴立立 • 
  • 16. DI ⽅方
  • 17. DI public class DemoModule extends GModule { public DemoModule(GContext context) { super(context); } @Override protected void configure() { configure_context(); bind(DemoContext.class).toInstance((DemoContext)gcontext); bind(GErrorModel.class).to(DemoErrorModel.class).in (Singleton.class); bind(GModel.class).to(DemoModel.class).in(Singleton.class); bind(GAgent.class).to(DemoAgent.class).in(Singleton.class); bind(GController.class).to(DemoController.class); bind(IDemoRestDriver.class).to(DemoG3Driver.class); } }
  • 18. DI public class CustomerRestViewActivity extends GActivity<DemoController> { @LayoutView(R.id.header) TextView mHeader; @ResourceString(R.string.header) String mHeaderLabel; @ResourceColor(R.color.header) Color mHeaderColor; @IntentExtra("message") String mMessage; public CustomerRestViewActivity() { addTrait(new ListViewTrait()); } …
  • 19. •  Scala⾔言 •  Java (Scala) class MyListActivity extends Activity with ListViewer class MyMapActivity extends MapActivity with MyLocationOverlayViewer
  • 21. public class CustomerRestViewActivity extends GActivity<DemoController> { @LayoutView(R.id.header) TextView mHeader; @ResourceString(R.string.header) String mHeaderLabel; @ResourceColor(R.color.header) Color mHeaderColor; @IntentExtra("message") String mMessage; public CustomerRestViewActivity() { addTrait(new ListViewTrait()); } …
  • 22. •  DI ⽬目 Android
  • 23. •  SimpleModeler •  ⾃自 ⽣生 •  ⼟土 ⾃自 ⽣生 •  CSV g3 Android ⽣生 •  g4 •  •  ⾮非 •  DI (Dependency Injection) •  •  g4 Guice •  •  ⽴立立 •  Java⾔言 g4
  • 24. END