commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Blinov (JIRA)" <>
Subject [jira] [Commented] (JEXL-229) Introduce new syntax for class literals: Class<T> and Type<T>
Date Wed, 27 Sep 2017 15:01:00 GMT


Dmitri Blinov commented on JEXL-229:

I have found another solution to this problem. I have adjusted the {{JexlContext}} class to
resolve ant-ish style context properties like for example {{java.lang.Integer}} to the instances
of corresponding {{Class<java.lang.Integer>}} so it is now as easy to address {{Class<?>}}
objects as to write
{code}if (obj =~ java.util.Map){code}
Furthermore, I have added a property resolver for {{Class<?>}} objects to return static
class members, like for example {code}var one = java.math.BigInteger.ONE{code} This also allowed
me to access {{Class<?>}} objects for primitive types, since they are referenced via
{{TYPE}} static member of corresponding boxed type, like the following {code}java.lang.Integer.TYPE{code}
I think I have achieved what I was aiming at, a clean solution without functors and need to
use type names as strings. So I think it is better now to close this issue.

> Introduce new syntax for class literals: Class<T> and Type<T>
> -------------------------------------------------------------
>                 Key: JEXL-229
>                 URL:
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: 3.1
>            Reporter: Dmitri Blinov
>            Priority: Minor
> For the purpose of type checking in jexl, It whould be convenient to have some simple
syntax for referring to class types, like Class<String> or Type<Boolean>. Literal
Class<T> should refer to general classes, and literal Type<T> should refer to
primitive type classes. For literals Class<T> it could be possible to specify partal
class name, which should resolve to classes in basic packages like java.lang and java.util,
for example.

This message was sent by Atlassian JIRA

View raw message