You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by "Howard M. Lewis Ship (JIRA)" <hi...@jakarta.apache.org> on 2005/01/28 16:35:18 UTC
[jira] Created: (HIVEMIND-87) object translator: optionally, specify interface
object translator: optionally, specify interface
------------------------------------------------
Key: HIVEMIND-87
URL: http://issues.apache.org/jira/browse/HIVEMIND-87
Project: HiveMind
Type: New Feature
Components: framework
Reporter: Howard M. Lewis Ship
It is very commonly the case when using the object translator that the object must be assignable to a particular interface (or extend a particular class). In most cases, the value obtained will be injected into a property of an object and a ClassCastException will occur that will (hopefully) identify the invalid contribution.
In some cases, the object may go into some form of untyped collection, causing a class cast exception at a later point.
It would be nice if the object translator could enforce an assignability check directly, ie.
<attribute name="object" translator="object:java.lang.Runnable"/>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Commented: (HIVEMIND-87) object translator: optionally,
specify interface
Posted by "Knut Wannheden (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-87?page=comments#action_12417442 ]
Knut Wannheden commented on HIVEMIND-87:
----------------------------------------
This could be achieved by using a translator initializer. Then the syntax would be with a comma. E.g.
<attribute name="object" translator="object,java.lang.Runnable"/>
(Although I wonder if a '|' or ':' wouldn't be better as separator.)
The object translator would have to work out how to perform the assignability check if given both a type in the initializer and a type as parameter to the translate() method. I.e. what to do if these are conflicting and which one is "stronger".
> object translator: optionally, specify interface
> ------------------------------------------------
>
> Key: HIVEMIND-87
> URL: http://issues.apache.org/jira/browse/HIVEMIND-87
> Project: HiveMind
> Type: New Feature
> Components: framework
> Reporter: Howard M. Lewis Ship
>
> It is very commonly the case when using the object translator that the object must be assignable to a particular interface (or extend a particular class). In most cases, the value obtained will be injected into a property of an object and a ClassCastException will occur that will (hopefully) identify the invalid contribution.
> In some cases, the object may go into some form of untyped collection, causing a class cast exception at a later point.
> It would be nice if the object translator could enforce an assignability check directly, ie.
> <attribute name="object" translator="object:java.lang.Runnable"/>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
[jira] Commented: (HIVEMIND-87) object translator: optionally,
specify interface
Posted by "Knut Wannheden (JIRA)" <hi...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/HIVEMIND-87?page=comments#action_12417457 ]
Knut Wannheden commented on HIVEMIND-87:
----------------------------------------
The initializer approach as described in the previous comment does unfortunately not work as the object translator is contributed as a (already initialized) service object. Other possible solutions would be:
1. let the client of the translator implement the required assignability logic
2. contribute the object translator as a translator factory service (3rd kind of translator contribution)
3. integrate the initializer as an optional parameter to the Translator#translate() method
Any other ideas or thoughts?
> object translator: optionally, specify interface
> ------------------------------------------------
>
> Key: HIVEMIND-87
> URL: http://issues.apache.org/jira/browse/HIVEMIND-87
> Project: HiveMind
> Type: New Feature
> Components: framework
> Reporter: Howard M. Lewis Ship
>
> It is very commonly the case when using the object translator that the object must be assignable to a particular interface (or extend a particular class). In most cases, the value obtained will be injected into a property of an object and a ClassCastException will occur that will (hopefully) identify the invalid contribution.
> In some cases, the object may go into some form of untyped collection, causing a class cast exception at a later point.
> It would be nice if the object translator could enforce an assignability check directly, ie.
> <attribute name="object" translator="object:java.lang.Runnable"/>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org