stephenh / bindgen Goto Github PK
View Code? Open in Web Editor NEWdata binding framework
License: Other
data binding framework
License: Other
It will generate invalid code if inner classes have protected methods(/properties?)
See the following for a test:
https://github.com/selckin/bindgen/compare/4129d7e89a...914d724dae
@OverRide should be put on "setWithRoot" and "set" methods by generator when generating inner binding classes(My*Binder) which extend *BindingPath in order to eliminate compilation warnings.
Hi,
Im very interested in using bindgen in my project but I have one problem.
Now when I annotate my class with @bindable Bindgen generates binding for all fields, methods etc.
I would like to limit this to only few fields. I know that I can do this with "scope" or "skip attribute" in binding.properties but this solution has two issues:
1)its hard to "synchronize" class source file with this file. Every time I add field or method to the class which should not be bindable I have to modify binding.properties file. With a lot of bindable classes binding.properties could be quite large and messy.
2)attribute names in binding.properties are strings, when your refactor your code (move or change attribute name) you have to change binding.properties file as well. As I understand purpose of Bindgen it was created to not put attribute/method names in strings.
I have an idea how to limit bindings without using binding.properties file.
First I propose to add "scope"attribute to Bindable anotation. It could have values: ALL, FIELDS, METHODS, NONE...
Default value could be ALL
So @bindable is equivalent to @bindable(scope=ALL) - backward comability
@bindable(scope=FIELDS) generates bindings just for fields, METHOS for methods etc.
If you would like to generate bindings just for few (from many) fields you could use:
@bindable(scope=NONE)
and put @bindable (or simillar) annotation next to field:
@bindable int age;
For me(and probably not only for me) @bindable(scope=NONE) is prefered way of work, so it would be nice to add to binding.properties setting like "defaultScope" - when you add to the binding.properties something like:
defaultScope=NONE
than
@binding is equivalent to @binding(scope=NONE).
@binding (scope=NONE) has adventage because it allows you to fully control behaviour of framework - you could select (by annotating them with @bindable or similar) fields or methos which should be annotated.
It is only an idea, implementation details could vary, for example it could also looks like this:
@bindable(fields=true, methods=true)
Going futher it would be nice to have more control over field/method selection, for example:
@bindable(fields=PROTECTED, methods=PUBLIC)
Going more further it would be nice to have AspectJ(or regexp) like expressions:
@bindable(fields="public int " methods=" int bindbale_(_)")
this means:
genrate bindings for all public int fields
and generate bindings for all methods returning int where method name starts with bindable
Im very interested in Bindgen, so If you need any help in extending this framework I could help.
Regards Daniel
Hi @stephenh, can i integrate this Project with maven, and if yes with which dependency?
Since bindgen 2.10, fields with primitive types cannot be set as all bindings are generated as read-only. You can reproduce this by running MethodExampleTest in the examples.
You should consider adding an option to include automatically generated suid in your binding classes or some user defined suid.
Reason:
The company i work for has a global warning policy that threats missing suid in serializable class as a warning, and we have a requirement that the project has to have 0 warnings.
This prevents us from using the library although we are quite eager to do so.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.