[Databinding] WritableValue constructor parmeters type [message #313551] |
Sun, 18 March 2007 12:23  |
Eclipse User |
|
|
|
Hello,
I'm a happy JFace Databinding user but I was wondering this week why for
WritableValue object you choose to create:
public WritableValue(Object initialValue, Object valueType) {}
instead of
public WritableValue(Object initialValue, Class valueType) {}
?
When I wrongly switched the 2 parameters, it has led me to objects not
bound and bug difficult to find.
Would it be possible to at least do the following at the beginning of the
constructor?
assert( valueType instanceof Class);
Thanks
Fred
|
|
|
Re: [Databinding] WritableValue constructor parmeters type [message #313555 is a reply to message #313551] |
Mon, 19 March 2007 06:41  |
Eclipse User |
|
|
|
FREDERIC CONROTTE wrote:
> Hello,
>
> I'm a happy JFace Databinding user but I was wondering this week why for
> WritableValue object you choose to create:
>
> public WritableValue(Object initialValue, Object valueType) {}
>
> instead of
>
> public WritableValue(Object initialValue, Class valueType) {}
>
> ?
>
>
> When I wrongly switched the 2 parameters, it has led me to objects not
> bound and bug difficult to find.
>
> Would it be possible to at least do the following at the beginning of
> the constructor?
>
> assert( valueType instanceof Class);
The databinding lib is able to handle extended concepts of
types, thus "valueType" is not necessarily of type Class.
You could create your own type system (e.g. with strings)
and use it here.
AFAIK this feature is already in use, e.g in GEF(?).
One could propose a feature request for factory methods
which at on Classes, because this often is the choosen
type system, e.g.
public final class Factory {
public static final WritableValue makeWritableValue(
Object initialValue, Class valueType) {
return new WritableValue(initialValue, valueType);
}
}
Greetings from Bremen
Daniel Krügler
|
|
|
Powered by
FUDForum. Page generated in 0.04853 seconds