Nice TWiki > Doc > UsingJavaFromNice (r1.1 vs. r1.3) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Doc . { Changes | Index | Search | Go }
 <<O>>  Difference Topic UsingJavaFromNice (r1.3 - 07 Mar 2003 - AlexGreif)
Deleted:
<
<

nice -> static java method

Deleted:
<
<

Deleted:
<
<

nice -> static java function

Deleted:
<
<

javanice
Added:
>
>

Deleted:
<
<


Changed:
<
<

List getList() = native List Foo.getList();

>
>

List<String> getList() = native List Foo.getList();

Deleted:
<
<

Deleted:
<
<

I'm not sure why you distinguished methods (returning void?) and functions. I think the point here is that if the Java code uses parameterized types (like List, Collection, Map, ...), then you need a native declaration in Nice to specify their precise type.

Changed:
<
<

Note: your List was printed in Wiki as List, because was interpreted as a tag. I did not understand a thing at first because of that, and thought there was a bug in the compiler! :-) I added verbatim in addition to pre to solve this problem. Isn't there a simpler way, like a tag? Could be define that in TWiki?

>
>

ALERT! If the Java code uses parameterized types (like List, Collection, Map, ...), then you need a native declaration in Nice to specify their precise type.

I added verbatim in addition to pre to solve this problem. Isn't there a simpler way, like a <code> tag? Could be define that in TWiki?

Added:
>
>

I think wiki cannot handle this -- AlexGreif


 <<O>>  Difference Topic UsingJavaFromNice (r1.2 - 07 Mar 2003 - DanielBonniot)
Added:
>
>


Added:
>
>

Added:
>
>

-- AlexGreif - 07 Mar 2003

Added:
>
>

I'm not sure why you distinguished methods (returning void?) and functions. I think the point here is that if the Java code uses parameterized types (like List, Collection, Map, ...), then you need a native declaration in Nice to specify their precise type.

Changed:
<
<

-- AlexGreif - 07 Mar 2003

>
>

Note: your List was printed in Wiki as List, because was interpreted as a tag. I did not understand a thing at first because of that, and thought there was a bug in the compiler! :-) I added verbatim in addition to pre to solve this problem. Isn't there a simpler way, like a tag? Could be define that in TWiki? -- DanielBonniot


 <<O>>  Difference Topic UsingJavaFromNice (r1.1 - 07 Mar 2003 - AlexGreif)
Added:
>
>

%META:TOPICINFO{author="AlexGreif" date="1047032340" format="1.0" version="1.1"}% %META:TOPICPARENT{name="NiceTutorial"}% This topic gives some tips and hints how to use Java from Nice

nice -> static java method

javanice
package test;

public class Foo {
 static public String sayHello() {
  System.out.println("hello");
 }   
}
package test;

public void main(String[] args) {
 Foo.sayHello();
}

nice -> static java function

javanice
package test;

public class Foo {
 static public String sayHello() {
  return "hello";
 }   
}
package test;

public void main(String[] args) {
 println(Foo.sayHello());
}
package test1;
import java.util.*;

public class Foo {
   static public List getList() {
      List l = new ArrayList();
      l.add("one");
      l.add("two");
      
      return l;
   }
}
package test1;
import java.util.*;

List getList() = native List Foo.getList();

public void main(String[] args) {
   getList().foreach(String s => println(s));
}

-- AlexGreif - 07 Mar 2003


Topic UsingJavaFromNice . { View | Diffs | r1.3 | > | r1.2 | > | r1.1 | More }
Revision r1.1 - 07 Mar 2003 - 10:19 GMT - AlexGreif
Revision r1.3 - 07 Mar 2003 - 14:45 GMT - AlexGreif
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.