List<Map>

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

List<Map>

gpatrick
This is the Java code:
List<Map> systems = (List<Map>) client.invoke("system.listUserSystems", args);

I've tried:
systems = LinkedList() client.invoke("system.listUserSystems",args)

Which doesn't add anything.

Also this Java string:
String auth = (String) client.invoke("auth.login", args);

I've tried:
auth = String
auth = (String) client.invoke("system.listUserSystems",args)

Which returns:
    function main(String[])
 14 +++   auth = (String) client.invoke("auth.login",args)
    +++           ^^^^^^
    +++ Error: Result of this expression cannot be just a type; it must have a value
Reply | Threaded
Open this post in threaded view
|

Re: List<Map>

gpatrick
--systems = LinkedList() client.invoke("system.listUserSystems",args)
  systems = LinkedList()
  systems.add(client.invoke("system.listUserSystems",args))
  loop server over systems
    System.out.println(server.get("name"))
  end

Program XmlRpcTest.nrx
  === class XmlRpcTest ===
    function main(String[])
 19 +++     System.out.println(server.get("name"))
    +++                               ^^^
    +++ Error: The method 'get(java.lang.String)' cannot be found in class 'java.lang.Object' or a superclass
      signals XmlRpcFault
Compilation of 'XmlRpcTest.nrx' failed [one error]
Reply | Threaded
Open this post in threaded view
|

Re: List<Map>

Kermit Kiser
In reply to this post by gpatrick
(Type) xxx

is a syntax error in NetRexx. The translator requires a type to be
followed by an object or nothing therefore a type in parens is not
valid. In the following program, the third instruction will give the
same error message, the others will not:

a = String

b = String 'xyz'

c = (String) 'xyz'

d = (String 'xyz')


On 3/18/2015 6:10 AM, gpatrick wrote:

> This is the Java code:
> List<Map> systems = (List<Map>) client.invoke("system.listUserSystems",
> args);
>
> I've tried:
> systems = LinkedList() client.invoke("system.listUserSystems",args)
>
> Which doesn't add anything.
>
> Also this Java string:
> String auth = (String) client.invoke("auth.login", args);
>
> I've tried:
> auth = String
> auth = (String) client.invoke("system.listUserSystems",args)
>
> Which returns:
>      function main(String[])
>   14 +++   auth = (String) client.invoke("auth.login",args)
>      +++           ^^^^^^
>      +++ Error: Result of this expression cannot be just a type; it must have
> a value
>
>
>
> --
> View this message in context: http://ibm-netrexx.215625.n3.nabble.com/List-Map-tp4027371.html
> Sent from the ibm-netrexx mailing list archive at Nabble.com.
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: List<Map>

Kermit Kiser
In reply to this post by gpatrick
NetRexx does not support Java generics. In practice this means that the
elements of a generic container such as LinkedList are of type "Object".
You must cast each element to it's original type before using it:

(WhateverType server).get("name")


On 3/18/2015 10:47 AM, gpatrick wrote:

> --systems = LinkedList() client.invoke("system.listUserSystems",args)
>    systems = LinkedList()
>    systems.add(client.invoke("system.listUserSystems",args))
>    loop server over systems
>      System.out.println(server.get("name"))
>    end
>
> Program XmlRpcTest.nrx
>    === class XmlRpcTest ===
>      function main(String[])
>   19 +++     System.out.println(server.get("name"))
>      +++                               ^^^
>      +++ Error: The method 'get(java.lang.String)' cannot be found in class
> 'java.lang.Object' or a superclass
>        signals XmlRpcFault
> Compilation of 'XmlRpcTest.nrx' failed [one error]
>
>
>
>
> --
> View this message in context: http://ibm-netrexx.215625.n3.nabble.com/List-Map-tp4027371p4027372.html
> Sent from the ibm-netrexx mailing list archive at Nabble.com.
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: List<Map>

gpatrick
I kindly thank you.