<div dir="ltr"><div><div><div><div><div>Hi All,<br><br></div>I am releasing the first version of Helperl, a convenience wrapper for JInterface.<br><br></div><div>Project home page (at Bit Bucket): <a href="https://bitbucket.org/alexarnon/helperl">https://bitbucket.org/alexarnon/helperl</a><br>
</div><div><br></div>The idea was to try and make JInterface usage almost pleasant, because really guys, that API is still rocking all the hotness of Java 1.4.<br><br></div><div>Helperl has been successfully used in integration experiments. However, it is the first released version, and should be considered Alpha quality.<br>
</div><div><br></div>Examples:<br><br></div>* Construction of simple types, lists and tuples:<br><br><span style="font-family:courier new,monospace">--------------------<br><br></span></div><div><span style="font-family:courier new,monospace">12345 <- erl(12345)<br>
<br><<"hello">> <- erl("hello")<br><br></span></div><div><span style="font-family:courier new,monospace">'hello' <- eAtom("hello")<br><br></span></div>
<div><span style="font-family:courier new,monospace">[12345, 'qwerty'] <- erl(12345, eAtom("qwerty"))<br><br></span></div><div><span style="font-family:courier new,monospace">{ping, [123, 456]} <- eTuple(eAtom("ping"), erl(123, 456))<br>
</span></div><div><br><span style="font-family:courier new,monospace">--------------------<br><br></span><br>* Pattern matching:<br><br></div><div>Match {ping, From, Message} where is_pid(From) and is_list(Message), and extract the values.<br>
<br></div><div><br><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">--------------------<br><br></span> CompositePattern p = <br> pAnd(<br> pTuple( eAtom("ping"), p_("From"), p_("Message") ),<br>
</span></div><div><span style="font-family:courier new,monospace"> pIsPid("From"),<br></span></div><div><span style="font-family:courier new,monospace"> pIsList("Message") );<br><br>
</span></div><div><span style="font-family:courier new,monospace"> Map<String, OtpErlangObject> result = p.match(someInput);<br><br></span></div><div><span style="font-family:courier new,monospace"> if (result == null) {<br>
</span></div><div><span style="font-family:courier new,monospace"> // No match.<br></span></div><div><span style="font-family:courier new,monospace"> } else {<br></span></div><div><span style="font-family:courier new,monospace"> // Extract!<br>
</span></div><div><span style="font-family:courier new,monospace"> OtpErlangObject from = result.get("From");<br></span></div><div><span style="font-family:courier new,monospace"> OtpErlangObject message = result.get("Message");<br>
<br> // ...<br> }<br><br>--------------------</span><br><br>To download the source code and jars, please look at the Bit Bucket repo, or check out Maven Central, using:<br><br><span style="font-family:courier new,monospace"> <dependency><br>
<groupId>net.shambolica.helperl</groupId><br> <artifactId>helperl</artifactId><br> <version>0.2.0</version><br> </dependency></span><br><br>Note that the Maven artifact has a dependency on JInterface 1.5.6.<br>
<br></div><div>Please feel free to provide feedback!<br><br><br></div><div>Cheers,<br>Alex.<br><br></div></div>