Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Provide Ruby binding impls #112

Open
enebo opened this issue Mar 13, 2017 · 1 comment
Open

Enhancement: Provide Ruby binding impls #112

enebo opened this issue Mar 13, 2017 · 1 comment

Comments

@enebo
Copy link
Member

enebo commented Mar 13, 2017

java_import Java::javafx.beans.binding.StringBinding

class RubyStringBinding < StringBinding
  def initialize(property:, method:)
    super()
    @property, @method = property, method
    bind @property
  end

  def computeValue
    property_value = @property.get
    return unless property_value
    property_value.__send__ @method
  end
end

The Java bindings provided from Bindings assumes Java reflective lookup so they cannot see our Ruby methods...

@enebo
Copy link
Member Author

enebo commented Mar 13, 2017

I should also point out that StringBinding is just some convenience methods on a type-erased type.

abstract StringBinding implements Binding<String>

so I think we can make a single binding to rule them all but we might not be able to leverage one of their abstract classes (unsure about that).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant