polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "zhuangmz08" <zhuangm...@qq.com>
Subject generic property? value composite as map keys?
Date Thu, 14 Apr 2016 16:32:57 GMT
Hi, I would like to ask two questions, any help will be appreciated. 


1. Can I use generic type in Property? 
DateTimeInterval1 fails while DateTimeInterval2 is ok in the following snippet.
===========SNIPPET 1===========
public interface ITimeInterval<T> {
	Property<T> start();
	Property<T> end();
}
public interface DateTimeInterval1 extends ITimeInterval<LocalDate>, ValueComposite
{ // fail
}


public interface DateTimeInterval2 extends ValueComposite { // ok
	Property<LocalDate> start();
	Property<LocalDate> end();
}
===========SNIPPET 1===========


2. Can I use ValueComposite as map keys?
map1 fails while map2 is ok in the following snippet.
===========SNIPPET 2===========
public interface TestEntity extends EntityComposite {
	Property<Map<DateTimeInterval2, String>> map1();	// fail
	Property<Map<String, DateTimeInterval2>> map2();	// ok
}
===========SNIPPET 2===========
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message