chrisbu / dartwatch-JsonObject

JsonObject which allows dot notation access to JSON.parse'd objects. Read the article on http://www.dartlang.org/articles/json-web-service/
http://www.dartlang.org/articles/json-web-service/
MIT License
83 stars 25 forks source link

getters and setters #12

Closed cassiot closed 11 years ago

cassiot commented 12 years ago

All examples of JsonObject have classes with no variables, or getters and setters. This makes sense since JsonObject works behind the scenes implementig noSuchMethod, but what is the difference to have a Person object or a pure JsonObject if Person is empty? What is the difference of Person or Address if they're both empty classes?

I don't know if I'm missing something but it's not great yet for me. I was trying to solve that making something like:

class Person extends JsonObject{ String get Name => this["Name"]; set Name(String value) => this["Name"] = value; }

What is your impression about that? Using mirrors it could be implemented automatically inside JsonObject class. Is this reasonable?

chrisbu commented 11 years ago

Hi,

Take a look at the test_todo_vo.dart - this uses a concrete class, which implements an interface (to provide strong typing), but is itself an empty class

Hope that helps, Chris.