Ticket #780 (closed enhancement: fixed)

Opened 10 months ago

Last modified 2 months ago

Support for Java 'generics'.

Reported by: amit Assigned to: pradeep
Priority: critical Milestone: 0.9.1
Component: topaz Version: 0.8.3-SNAPSHOT
Keywords: generics Cc:
Blocking: Blocked By:

Description

Implementation of Annotea annotation body has repeatedly brought up the example of being able to override type mapping for predicates for associations. Use of java generics could be useful here.

Dependency Graph

Change History

03/03/08 10:59:49 changed by amit

  • milestone changed from 0.8.3 to 0.9.0.

03/19/08 15:38:40 changed by amit

  • priority changed from high to critical.

04/03/08 14:42:00 changed by amit

  • milestone deleted.

07/31/08 21:33:53 changed by amit

  • blocking changed.
  • blockedby changed.
  • milestone set to 0.9.1.

09/08/08 18:03:33 changed by pradeep

  • status changed from new to assigned.

09/16/08 22:01:17 changed by pradeep

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [6432]) Support for java generics. No runtime dynamically defined entities - but support for statically defined subtypes of generic base classes. eg.

@Entity
class Foo<T> {
  T getFoo() {...}
  @Predicate()
  void setFoo(T v) {...}
}

@Entity
class Bar extends Foo<Integer> {
}

Bar b = new Bar();
Foo f = new Foo<Double>();

'b' will be persisted correctly. But 'f' will not since by default getFoo() is supposed to be an rdfs object-property and therefore the insert will fail since a URI is what is expected for the 'foo' property.

Note also that java.util.Collection of generics and arrays of generics are also supported. eg. List<T> getFoos() or T[] getFoos() both are valid generic base class propery types.

T can resolve to any association or literal. However Foo<T> as a return type for getFoo() is not supported. From the example above, the resolved Foo<Integer> is not recognized as Bar in this case. So the generic type variable 'T' will be ignored in this case.

This closes #780.