Skip to content

Commit

Permalink
make ENative.getNativeClasses have a default implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
krestenkrab committed Dec 15, 2009
1 parent ebf0a61 commit 12340ef
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/main/java/erjang/ENative.java
Expand Up @@ -20,8 +20,25 @@
package erjang;

/**
* Base class for native code.
*
* To implement a native (BIF) for module named <code>foo</code>, create a subclass
* of this named <code>erjang.m.foo.Native</code>.
*
* See {@link erjang.m.ets.Native} (the BIFs for <code>ets</code>), which is
* the appointed "good style to copy" for coding conventions.
*
*/
public abstract class ENative {
protected abstract Class<?>[] getNativeClasses();

/**
* if you want to put the BIFs in multiple class files, you can tell which
* class files here. Normally that is not needed, but the module <code>erlang</code>
* has so many BIFs that it is very inconvenient to have them in one large
* file.
*/

protected Class<?>[] getNativeClasses() {
return new Class[] { getClass() };
}
}

0 comments on commit 12340ef

Please sign in to comment.