From a253d8b94d88ec2f0c28ba2399262d942980ba07 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 5 Sep 2016 11:26:29 +0300 Subject: Add documentation test for custom converters Change-Id: I84621b6b568095b1b7f86068fa992dd570f8a103 --- documentation/datamodel/datamodel-forms.asciidoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'documentation/datamodel') diff --git a/documentation/datamodel/datamodel-forms.asciidoc b/documentation/datamodel/datamodel-forms.asciidoc index 5ec548e8be..b86cf8f672 100644 --- a/documentation/datamodel/datamodel-forms.asciidoc +++ b/documentation/datamodel/datamodel-forms.asciidoc @@ -282,19 +282,19 @@ Another option is to directly implement the [interfacename]#Converter# interface ---- class MyConverter implements Converter { @Override - public Result fromField(String fieldValue) { + public Result convertToModel(String fieldValue, Locale locale) { // Produces a converted value or an error try { // ok is a static helper method that creates a Result - return ok(Integer.valueOf(fieldValue)); + return Result.ok(Integer.valueOf(fieldValue)); } catch (NumberFormatException e) { // error is a static helper method that creates a Result - return error("Please enter a number"); + return Result.error("Please enter a number"); } } @Override - public String toField(Integer integer) { + public String convertToPresentation(Integer integer, Locale locale) { // Converting to the field type should always succeed, // so there is no support for returning an error Result. return String.valueOf(integer); -- cgit v1.2.3