Uses to_java
coercion mechanism to convert ruby objects to native java objects when an attribute is assigned.
The primary purpose here is reopening a java class that has been defined previously (such as JAX-WS classes) and adding support for type coercion when being set to a Ruby Object.
Add this line to your application's Gemfile:
gem 'coerced_attr_writer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install coerced_attr_writer
class Java::ComSomeObjectNamespaceSequence::Request
coerced_attr_writer :property
end
When coerced_attr_writer is encountered this extension will reflect on the setters of the java class and find the
appropriate types that can be used to set property
by looking for setProperty(Type)
When a ruby object is assigned to the property then the to_java
type coercion registries are inspected for a matching
coercion before the property is set.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request