You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tamaya.apache.org by "Anatole Tresch (JIRA)" <ji...@apache.org> on 2015/06/14 00:22:00 UTC

[jira] [Resolved] (TAMAYA-74) Support for type narrowing

     [ https://issues.apache.org/jira/browse/TAMAYA-74?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anatole Tresch resolved TAMAYA-74.
----------------------------------
    Resolution: Implemented

The converters provided are of the following type and returned in the following order:
* Converters mapped explicitly to the required target type are returned first, ordered by decreasing priority. This means, if explicit converters are registered these are used primarly for converting a value
* The target type of each explicitly registered converter also can be transitively mapped to 1) all directly implemented interfaces, 2) all its superclasses (except Object), 3) all the interfaces  implemented by its superclasses. These groups of transitive converters is returned similarly in the order as mentioned, whereas also here a priority based decreasing ordering is applied.
* java.lang wrapper classes and native types are automatically mapped.
* If no explicit converters are registered, for Enum types a default implementation is provided that compares the configuration values with the different enum members defined (cases sensitive mapping).

So given that list above directly registered mappings always are tried first, before any transitive mapping should be used. Also in all cases @Priority annotations are honored for ordering of the converters in place. Transitive conversion is supported for all directly implemented interfaces (including inherited ones) and the inheritance hierarchy (except Object). Superinterfaces of implemented interfaces are ignored.

> Support for type narrowing
> --------------------------
>
>                 Key: TAMAYA-74
>                 URL: https://issues.apache.org/jira/browse/TAMAYA-74
>             Project: Tamaya
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 0.1-incubating
>            Reporter: Oliver B. Fischer
>            Assignee: Anatole Tresch
>             Fix For: 0.1-incubating
>
>
> Tamays should support type narrowing. Currently a user of Tamaya can only specify the concrete target type when getting a property value as object value.
> I would like to see support for type narrowing in Tamaya to according to these rules:
> Given an interface or abstract class A and a class B implementing or inheriting from A. If a user requests a property of type A Tamaya should be able to determine that B is a valid return value for this request and return an instance of B.
> Given an interface  or abstract class A and two classes B and C implementing or inheriting from A. If a user requests a property of type A Tamays should be able to determine that B and C are valid return values for this request and return an instance of B or C.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)