You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Dan Haywood (JIRA)" <ji...@apache.org> on 2017/07/20 18:10:00 UTC

[jira] [Updated] (ISIS-1484) Extend @Parameter annotation to provide a class to obtain the default for a parameter

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

Dan Haywood updated ISIS-1484:
------------------------------
    Description: 
{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.

  was:
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.


> Extend @Parameter annotation to provide a class to obtain the default for a parameter
> -------------------------------------------------------------------------------------
>
>                 Key: ISIS-1484
>                 URL: https://issues.apache.org/jira/browse/ISIS-1484
>             Project: Isis
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 1.13.0
>            Reporter: Dan Haywood
>            Priority: Minor
>             Fix For: 2.2.0
>
>
> {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
(v6.4.14#64029)