MVEL
   HOME

TheInfoList



OR:

MVFLEX Expression Language (MVEL) is a hybrid dynamic/statically typed, embeddable Expression Language and runtime for the
Java Platform Java is a set of computer software and specifications developed by James Gosling at Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cro ...
. Originally started as a utility language for an application framework, the project is now developed completely independently. MVEL is typically used for exposing basic logic to end-users and programmers through configuration such as
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
files or
annotations An annotation is extra information associated with a particular point in a document or other piece of information. It can be a note that includes a comment or explanation. Annotations are sometimes presented in the margin of book pages. For anno ...
. It may also be used to parse simple JavaBean expressions. The runtime allows MVEL expressions to be executed either interpretively, or through a pre-compilation process with support for runtime
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
generation to remove overhead. Since MVEL is meant to augment Java-based software, it borrows most of its syntax directly from the Java programming language with some minor differences and additional capabilities. For example: as a side effect of MVEL's typing model, which treats class and method references as regular variables, it is possible to use both class and function pointers (but only for static methods). millis = System.currentTimeMillis; // get millis time = millis(); MVEL also allows collections to be represented as folds (or projections) in a Lisp-like syntax. namesOfParents = (parent.name in (children in employees));


Hello world example

System.out.println("Hello, world!"); MVEL relies on Java namespaces and classes, but does not possess the ability to declare namespaces or classes.


Quicksort Example

Here is an example of the
Quicksort Quicksort is an efficient, general-purpose sorting algorithm. Quicksort was developed by British computer scientist Tony Hoare in 1959 and published in 1961, it is still a commonly used algorithm for sorting. Overall, it is slightly faster than ...
algorithm implemented in MVEL 2.0, demonstrating the scripting capabilities of the language. import java.util.*; // the main quicksort algorithm def quicksort(list) // define method to concatenate lists. def concat(list1, pivot, list2) // create a list to sort list = ,2,4,1,18,10,15,1,0 // sort it! quicksort(list);


See also

*
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mos ...
* OGNL * Expression Language


External links


MVEL Language Guide

original website
(not available any more) Scripting languages Free software programmed in Java (programming language) {{Prog-lang-stub