API + javadoc

This commit is contained in:
Renaud Pawlak 2017-07-10 16:11:42 +02:00
parent 1a7bf028fe
commit e8b127deef
8 changed files with 48 additions and 16 deletions

View File

@ -2,7 +2,7 @@ package def.js;
/**
* Creates a new function.
*/
public class Function extends def.js.Object {
public class Function extends def.js.Object implements FunctionalObject {
/**
* Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.
* @param thisArg The object to be used as the this object.
@ -40,5 +40,8 @@ public class Function extends def.js.Object {
native public java.lang.Object apply(java.lang.Object thisArg);
native public java.lang.Object caller(java.lang.Object... args);
protected Function(){}
@Override
native public <R> R $apply(Object... arguments);
}

View File

@ -0,0 +1,19 @@
package def.js;
/**
* This interface defines the <code>$apply</code> signature that allows invoking
* an object.
*
* <p>
* The code <code>o.$apply(args)</code> is transpiled to <code>o(args)</code>.
* Implementing this interface is not mandatory to create a functional object.
* Just defining the <code>$apply</code> function is enough. It is however
* recommended to implement this interface for readbility sake.
*
* @author Renaud Pawlak
*/
public interface FunctionalObject {
<R> R $apply(Object... arguments);
}

View File

@ -26,11 +26,6 @@ import java.lang.annotation.Target;
* This annotation type is used on elements that should be erased at generation
* time (casts and constructor invocations are removed).
*
* <p>
* This is mainly used for Java type disambiguation when the API defines two
* methods that have the same erasure. Most programmers will not have to use it
* directly.
*
* @author Renaud Pawlak
*/
@Retention(RetentionPolicy.RUNTIME)

View File

@ -32,8 +32,7 @@ import java.lang.annotation.Target;
*
* <p>
* The replacing code can contain variables substituted using a mustache-like
* convention ({{variableName}}). Note that no space is allowed between the
* variable name and the mustaches. Here is the list of supported variables:
* convention ({{variableName}}). Here is the list of supported variables:
*
* <ul>
* <li>{{className}}: the current class.</li>

View File

@ -2,7 +2,7 @@ package def.js;
/**
* Creates a new function.
*/
public class Function extends def.js.Object {
public class Function extends def.js.Object implements FunctionalObject {
/**
* Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.
* @param thisArg The object to be used as the this object.
@ -49,5 +49,8 @@ public class Function extends def.js.Object {
native public java.lang.Object apply(java.lang.Object thisArg);
native public java.lang.Object caller(java.lang.Object... args);
protected Function(){}
@Override
native public <R> R $apply(Object... arguments);
}

View File

@ -0,0 +1,19 @@
package def.js;
/**
* This interface defines the <code>$apply</code> signature that allows invoking
* an object.
*
* <p>
* The code <code>o.$apply(args)</code> is transpiled to <code>o(args)</code>.
* Implementing this interface is not mandatory to create a functional object.
* Just defining the <code>$apply</code> function is enough. It is however
* recommended to implement this interface for readbility sake.
*
* @author Renaud Pawlak
*/
public interface FunctionalObject {
<R> R $apply(Object... arguments);
}

View File

@ -26,11 +26,6 @@ import java.lang.annotation.Target;
* This annotation type is used on elements that should be erased at generation
* time (casts and constructor invocations are removed).
*
* <p>
* This is mainly used for Java type disambiguation when the API defines two
* methods that have the same erasure. Most programmers will not have to use it
* directly.
*
* @author Renaud Pawlak
*/
@Retention(RetentionPolicy.RUNTIME)

View File

@ -32,8 +32,7 @@ import java.lang.annotation.Target;
*
* <p>
* The replacing code can contain variables substituted using a mustache-like
* convention ({{variableName}}). Note that no space is allowed between the
* variable name and the mustaches. Here is the list of supported variables:
* convention ({{variableName}}). Here is the list of supported variables:
*
* <ul>
* <li>{{className}}: the current class.</li>