This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testNarrowToWideCompare() { | |
Serializable s = MVEL.compileExpression("new String('foo') == new Object()", | |
ParserContext.create().stronglyTyped()); | |
assertFalse((Boolean) MVEL.executeExpression(s)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String cls = ClassBuilder.define("org.foo.Foo") | |
.publicScope() | |
.body() | |
.privateField("name", String.class) | |
.initializesWith(Stmt.create().load("Mike Brock")) | |
.finish() | |
.publicMethod(String.class, "getName") | |
.append(Stmt.create().loadVariable("name").returnValue()) | |
.finish().toJavaString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String cls = ClassBuilder.implement(Bootstrapper.class) | |
.publicMethod(InterfaceInjectionContext.class, "bootstrapContainer") | |
.append(Stmt.create().addVariable("ctx", Stmt.create().newObject(InterfaceInjectionContext.class))) | |
.append(Stmt.create().loadVariable("ctx").returnValue()) | |
.finish().toJavaString(); | |
---[output]---- | |
package org.jboss.errai.ioc.client.api; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String s = StatementBuilder.create() | |
.addVariable("n", Integer.class) | |
.loadVariable("n") | |
.do_() | |
.append(StatementBuilder.create().loadVariable("n").assignValue(1)) | |
.finish() | |
.while_(BooleanOperator.GreaterThanOrEqual, 1) | |
.toJavaString(); | |
---[output]--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sample MVEL 2.1 Script | |
* "Functional QuickSort" | |
* by: Christopher Michael Brock, Inspired by: Dhanji Prasanna | |
*/ | |
def quicksort(list) { | |
list.size() <= 1 ? list : | |
(pivot = list[0]; (quicksort(($ in list if $ < pivot)) + pivot) | |
+ quicksort(($ in list if $ > pivot))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sample MVEL 2.1 Script | |
* "Functional QuickSort" | |
* by: Mike Brock, Inspired by: Dhanji Prasanna | |
*/ | |
def quicksort(list) { | |
list.size() <= 1 ? list : | |
(pivot = list[0]; (quicksort(($ in list if $ < pivot)) + pivot) | |
+ quicksort(($ in list if $ > pivot))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.jboss.errai.ioc.client.api; | |
import org.jboss.errai.ioc.client.api.Bootstrapper; | |
import org.jboss.errai.cdi.client.EventProducerTestModule; | |
import org.jboss.errai.cdi.client.api.Event; | |
import org.jboss.errai.cdi.client.EventObserverTestModule; | |
import org.jboss.errai.ioc.client.InterfaceInjectionContext; | |
import org.jboss.errai.cdi.client.ProducerTestModule; | |
import org.jboss.errai.cdi.client.EventProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean processAll() { | |
int start; | |
// brute force FTW | |
do { | |
start = processingEntries.size(); | |
List<ProcessingEntry> toRun = new ArrayList<ProcessingEntry>(processingEntries); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean processAll() { | |
int start; | |
// brute force FTW | |
do { | |
start = processingEntries.size(); | |
List<ProcessingEntry> toRun = new ArrayList<ProcessingEntry>(processingEntries); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.jboss.errai.ioc.client.api; | |
import org.jboss.errai.ioc.client.api.Bootstrapper; | |
import org.jboss.errai.cdi.client.ProducerTestModule; | |
import org.jboss.errai.cdi.client.ProducerDependentTestBean; | |
import org.jboss.errai.cdi.client.EventProducerTestModule; | |
import org.jboss.errai.cdi.client.api.Event; | |
import org.jboss.errai.cdi.client.EventObserverTestModule; | |
import org.jboss.errai.ioc.client.InterfaceInjectionContext; |
OlderNewer