Skip to content

Commit 6a30eed

Browse files
committed
Added NullComponent for conversion and validation
1 parent 02104dd commit 6a30eed

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎annotations/pom.xml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@
2626

2727
<dependencies>
2828

29-
<!--
3029
<dependency>
3130
<groupId>org.ocpsoft.prettyfaces</groupId>
3231
<artifactId>prettyfaces-core</artifactId>
3332
<version>${project.version}</version>
3433
</dependency>
35-
-->
3634

3735
<dependency>
3836
<groupId>org.ocpsoft.rewrite</groupId>

‎annotations/src/main/java/org/ocpsoft/prettyfaces/annotation/handlers/JSFConverterHandler.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import org.ocpsoft.logging.Logger;
1212
import org.ocpsoft.prettyfaces.annotation.JSFConverter;
13+
import org.ocpsoft.prettyfaces.core.util.NullComponent;
1314
import org.ocpsoft.rewrite.annotation.api.ClassContext;
1415
import org.ocpsoft.rewrite.annotation.api.FieldContext;
1516
import org.ocpsoft.rewrite.annotation.spi.AnnotationHandler;
@@ -100,7 +101,7 @@ public T convert(Rewrite event, EvaluationContext context, Object value)
100101
// run conversion
101102
String valueAsString = value != null ? value.toString() : null;
102103
try {
103-
return (T) converter.getAsObject(null, null, valueAsString);
104+
return (T) converter.getAsObject(null, new NullComponent(), valueAsString);
104105
}
105106
catch (ConverterException e) {
106107
return null;

‎annotations/src/main/java/org/ocpsoft/prettyfaces/annotation/handlers/JSFValidatorHandler.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import org.ocpsoft.logging.Logger;
1212
import org.ocpsoft.prettyfaces.annotation.JSFValidator;
13+
import org.ocpsoft.prettyfaces.core.util.NullComponent;
1314
import org.ocpsoft.rewrite.annotation.api.ClassContext;
1415
import org.ocpsoft.rewrite.annotation.api.FieldContext;
1516
import org.ocpsoft.rewrite.annotation.spi.AnnotationHandler;
@@ -98,7 +99,7 @@ public boolean validate(Rewrite event, EvaluationContext context, T value)
9899
// perform validation
99100
try {
100101

101-
validator.validate(null, null, value);
102+
validator.validate(null, new NullComponent(), value);
102103
return true;
103104
}
104105
catch (ValidatorException e) {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.ocpsoft.prettyfaces.core.util;
2+
3+
import javax.faces.component.UIComponentBase;
4+
5+
public class NullComponent extends UIComponentBase
6+
{
7+
@Override
8+
public String getFamily()
9+
{
10+
return "org.ocpsoft.prettyfaces.NullComponent";
11+
}
12+
}

0 commit comments

Comments
 (0)