You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Daniel Keir Haywood (Jira)" <ji...@apache.org> on 2021/01/17 18:32:00 UTC

[jira] [Reopened] (ISIS-1484) Extend @Parameter, specify a class to obtain the default

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

Daniel Keir Haywood reopened ISIS-1484:
---------------------------------------

> 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)