Dan Haywood created ISIS-1484:
---------------------------------

             Summary: 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
            Assignee: Dan Haywood
            Priority: Minor
             Fix For: 1.13.1


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.3.4#6332)

Reply via email to