You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dmitri Blinov (JIRA)" <ji...@apache.org> on 2017/09/27 15:01:00 UTC
[jira] [Commented] (JEXL-229) Introduce new syntax for class
literals: Class and Type
[ https://issues.apache.org/jira/browse/JEXL-229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16182695#comment-16182695 ]
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: https://issues.apache.org/jira/browse/JEXL-229
> 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
(v6.4.14#64029)