Hello IvyTeam

Is there a simple way calling self made generic classes? Like the List.

dao Dao<item>

in Ivyscript:
calling dao.get(id) the response would be of type Item.

generic Class:
T get(int id)

It would be great if there is a solution.

Thanks for an answer and Greetings

Edit: Trying to extend a class with the Generic doesn't help any further.
In java code those objects return items as it should and in ivyscript Objects are still returned.

public class DaoItemTest extends Dao<Item> {
    public DaoItemTest() {

asked 19.02.2014 at 13:18

Alexis's gravatar image

accept rate: 66%

edited 20.02.2014 at 08:57

Flavio%20Sadeghi's gravatar image

Flavio Sadeghi ♦♦

At the moment IvyScript can handle Generics only on its own List<?> class. On all other classes Generics are ignored. There is already a feature request for this. See issue 18147. As a workaround you can cast the result of the generic method to the right type:

item myItem = dao.get(0) as item;

answered 20.02.2014 at 08:56

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
accept rate: 74%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 19.02.2014 at 13:18

Seen: 1,273 times

Last updated: 20.02.2014 at 08:57