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

Daniel Keir Haywood updated ISIS-1484:
--------------------------------------
    Component/s: Isis Core

> Extend @Parameter, specify a class to obtain the default
> --------------------------------------------------------
>
>                 Key: ISIS-1484
>                 URL: https://issues.apache.org/jira/browse/ISIS-1484
>             Project: Isis
>          Issue Type: New Feature
>          Components: Isis Applib (programming model), Isis Core
>    Affects Versions: 1.13.0
>            Reporter: Daniel Keir Haywood
>            Priority: Minor
>
> {code}
> public void updateName(
>     @Parameter(defaultOf="Foo")  // if can specify an Object???
>     @ParameterLayout(named = "New name")
>     final String name) {
>     setName(newName);
> }
> {code}
> or a more elaborate (over-complicated?) design:
> eg:
> {code}
> public void updateName(
>     @Parameter(defaultFrom=ParameterDefaultFromProperty.class
>     @ParameterLayout(named = "New name")
>     final String name) {
>     setName(newName);
> }
> {code}
> where (part of the applib):
> {code}
> public interface ParameterDefaulter {
>     Object defaultFor(Object domainObject, String actionName, String 
> parameterName);
> } 
> {code}
> and the applib also provides a default implementation:
> {code}
> public class ParameterDefaultFromProperty implements ParametedDefaulter { ... 
> }
> {code}
> that uses an injected service (from core.runtime) to look up the parameter 
> value from the corresponding property of the object.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to