Behaviors
Providing native behaviors for many Java types.
Last updated
Providing native behaviors for many Java types.
Last updated
Consider the following: Java has an interface called Iterable
, which many types of Java collections implement. Now, if we found a way to make it follow the , we could easily iterate over any Java class in TypeScript.
This is where the Behavior API comes in. You define a predicate, and an apply as a behavior. Once that Java class is initialized somewhere, if it meets the predicate, it will be applied.
Keep in mind this is the TypeScript API. There will almost certainly also be a Java API.
Three types of behaviors will be natively implemented:
Native Iterable
support.
One-method interfaces will have a constructor to make them from lambdas.
Interfaces will have a constructor to turn objects into them. Each object will have its own method.