Bug 499101 - Property should store and provide its raw type
Summary: Property should store and provide its raw type
Status: RESOLVED FIXED
Alias: None
Product: Handly
Classification: Technology
Component: Core (show other bugs)
Version: 0.5   Edit
Hardware: All All
: P3 enhancement
Target Milestone: 0.6   Edit
Assignee: Vladimir Piskarev CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2016-08-03 09:10 EDT by Vladimir Piskarev CLA
Modified: 2016-08-05 07:23 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Piskarev CLA 2016-08-03 09:10:02 EDT
This request is a follow-up to bug 498752. Although the raw type of the property can always be computed from the type information already provided by the property, it would be more efficient and type-safe to store it in the property object itself, similarly to what Guice's TypeLiteral does.

The raw type of the property could then be used as follows:

    Property<T> p = ...
    Object o = ...
    Class<T> clazz = p.getRawType();
    if (p.getRawType().isInstance(o)) ...
    T t = p.getRawType().cast(o);