myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject [myfaces-tobago] 06/06: Generify
Date Thu, 15 Oct 2020 10:02:15 GMT
This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit d9f37ed1dc6af0ba0e88cb708e69b0226b0c1202
Author: Udo Schnurpfeil <udo.schnurpfeil@irian.eu>
AuthorDate: Thu Oct 15 12:01:40 2020 +0200

    Generify
---
 .../org/apache/myfaces/tobago/example/demo/OnOffConverter.java   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OnOffConverter.java
b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OnOffConverter.java
index e02b274..97dc9cd 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OnOffConverter.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OnOffConverter.java
@@ -28,12 +28,15 @@ import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import java.lang.invoke.MethodHandles;
 
-public class OnOffConverter implements Converter {
+/**
+ * Example of a boolean converter with a string representation in the model ("on" and "off").
+ */
+public class OnOffConverter implements Converter<String> {
 
   private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
   @Override
-  public Object getAsObject(final FacesContext context, final UIComponent component, final
String value)
+  public String getAsObject(final FacesContext facesContext, final UIComponent component,
final String value)
       throws ConverterException {
     final String result = Boolean.parseBoolean(value) ? "on" : "off";
     LOG.info("Got value = '" + value + "'. Result = '" + result + "'");
@@ -41,7 +44,7 @@ public class OnOffConverter implements Converter {
   }
 
   @Override
-  public String getAsString(final FacesContext context, final UIComponent component, final
Object value)
+  public String getAsString(final FacesContext facesContext, final UIComponent component,
final String value)
       throws ConverterException {
     final String result = "on".equals(value) ? Boolean.TRUE.toString() : Boolean.FALSE.toString();
     LOG.info("Got value = '" + value + "'. Result: '" + result + "'");


Mime
View raw message