stuck again - with META package this time

27 views
Skip to first unread message

Dietmar Höhmann

unread,
Jul 15, 2015, 2:55:26 AM7/15/15
to ceylon...@googlegroups.com
What I'm trying to do is access an attribute or a function within an object. But I neither know the class nor the attribute/function name in advance. Something like the following in Java:

        Object x = "Hallo";
        String meth = "toUpperCase";
       
        try {
            System.out.println(x.getClass().getMethod(meth, null).invoke(x, null));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


How do I do this in Ceylon?

Thanks for any hints!

Dietmar Höhmann

unread,
Jul 15, 2015, 3:07:50 AM7/15/15
to ceylon...@googlegroups.com
found it myself: Use the type function!
Reply all
Reply to author
Forward
0 new messages