simplemodelerによるandroidアプリ自動生成 with g3/g4

24
SimpleModeler による Android アプリwith g3/g4 20111015 浅海智晴

Upload: tomoharu-asami

Post on 31-May-2015

860 views

Category:

Technology


3 download

TRANSCRIPT

  • 1. SimpleModelerAndroid with g3/g42011 1015

2. 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 3. JJUG CCC 2011 Fall 1017() Scala http://www.java-users.jp/contents/events/ccc2011fall/index.html http://kokucheese.com/event/index/18473/ ( 1 ) 1029() () http://atnd.org/events/20884 4. CSV Android (&Rest ) 5. CSVSimpleModeler Scala DSL CSV #actor,parts,attrs customer,,name;phone;summary #resource goods,,note #event buy,customer;goods 6. g3 7. g3class 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)))} 8. g4 Android (Java) DI (Dependency Injection) g4 (loosely coupled)(high coherency) (testability) 9. DI(Dependency Injection) Spring Google Guice RoboGuice AndroidDI Guice 10. DI 11. DIpublic 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); }} 12. DIpublic class CustomerRestViewActivity extends GActivity {@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());} 13. Scala Java(Scala)class MyListActivity extends Activity with ListViewerclass MyMapActivity extends MapActivity withMyLocationOverlayViewer 14. 15. public class CustomerRestViewActivity extends GActivity {@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());} 16. DI Android 17. SimpleModeler CSV g3 Android g4 DI (Dependency Injection) g4 Guice Javag4 18. END