|
|||||
|
|||||
Useful Things |
Strong Typing Mode
Strong typing mode puts MVEL into a mode that requires that all types within a script are resolvable. This means that the compiler must be informed of the types of any and all injected variables. It also means that it's possible for the compiler to report on the return type at compile-time. Turning on Strong TypingYou can turn on strong typing with the The above code will throw an exception. MVEL is unable to safely qualify the type of the identifier 'str' in this case, and therefore cannot determine that toUpperCase() even is valid call. We can fix it like so: This will now succeed. In fact, we can also determine the return type of the expression now by calling If we changed the expression to: GenericsMVEL is also generics aware. You can specify type parameters for generic types by using the overloaded In this case, the expression compiles safely because MVEL is able to determine the return type of |
||||
|
Copyright 2003-2006 - The Codehaus. All rights reserved unless otherwise noted.
Powered by Atlassian Confluence
|
|||||