@Target(value={TYPE,PACKAGE})
@Retention(value=RUNTIME)
public @interface Adapter
This annotates adapter classes. These are classes that are used to supply methods for Java types when they
don't have a method that their Javascript counterpart has. For example for Number in Javascript you can do
number.toFixed(2). As in Java this method does not exist and as the Java Number-derived classes are all final, the
only alternative is to put this method in another class - an adapter class. All the methods of an adapter class must
have their first parameter the object to which the method is applied. The other parameters are the parameters
normally supplied to the Javascript method. For the number.toFixed example, the adapter will have a method
NumberAdapter.toFixed(String number, int position). The generated javascript code is the expected one:
number.toFixer(position).
Note: The adapter's method must be all static.
- Author:
- acraciun