Skip to content

Commit 02fe1ce

Browse files
committed
Update README.md
1 parent d2216c1 commit 02fe1ce

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

README.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This library supports **`Kotlin`** aswell
1616

1717
## Sample
1818

19-
Java
19+
### Java
2020

2121
```java
2222
import static br.com.fluentvalidator.predicate.ComparablePredicate.equalTo;
@@ -32,26 +32,27 @@ import br.com.fluentvalidator.AbstractValidator;
3232

3333
public class JavaValidatorBoy extends AbstractValidator<Boy> {
3434

35-
@Override
36-
protected void rules() {
35+
@Override
36+
protected void rules() {
3737

38-
ruleFor(Boy::getGender)
39-
.must(equalTo(Gender.MALE))
40-
.when(not(nullValue()))
41-
.withMessage("gender of boy must be MALE")
42-
.withFieldName("gender")
43-
.critical();
38+
ruleFor(Boy::getGender)
39+
.must(equalTo(Gender.MALE))
40+
.when(not(nullValue()))
41+
.withMessage("gender of boy must be MALE")
42+
.withFieldName("gender")
43+
.critical();
4444

45-
ruleFor(Boy::getName)
46-
.must(stringContains("John"))
47-
.when(not(stringEmptyOrNull()))
48-
.withMessage("child name must contains key John")
49-
.withFieldName("name");
50-
}
45+
ruleFor(Boy::getName)
46+
.must(stringContains("John"))
47+
.when(not(stringEmptyOrNull()))
48+
.withMessage("child name must contains key John")
49+
.withFieldName("name");
50+
}
5151

5252
}
5353
```
54-
Kotlin
54+
55+
### Kotlin
5556

5657
```kotlin
5758
import br.com.fluentvalidator.predicate.ComparablePredicate.equalTo;
@@ -67,24 +68,24 @@ import br.com.fluentvalidator.AbstractValidator;
6768

6869
class KotlinValidatorBoy : AbstractValidator<Boy> {
6970

70-
constructor() : super();
71-
72-
override fun rules() {
73-
74-
ruleFor(Boy::getGender)
75-
.must(equalTo(Gender.MALE))
76-
.`when`(not(nullValue()))
77-
.withMessage("gender of boy must be MALE")
78-
.withFieldName("gender")
79-
.critical();
80-
81-
ruleFor(Boy::getName)
82-
.must(stringContains("John"))
83-
.`when`(not(stringEmptyOrNull()))
84-
.withMessage("child name must contains key John")
85-
.withFieldName("name");
86-
}
87-
71+
constructor() : super();
72+
73+
override fun rules() {
74+
75+
ruleFor(Boy::getGender)
76+
.must(equalTo(Gender.MALE))
77+
.`when`(not(nullValue()))
78+
.withMessage("gender of boy must be MALE")
79+
.withFieldName("gender")
80+
.critical();
81+
82+
ruleFor(Boy::getName)
83+
.must(stringContains("John"))
84+
.`when`(not(stringEmptyOrNull()))
85+
.withMessage("child name must contains key John")
86+
.withFieldName("name");
87+
}
88+
8889
}
8990
```
9091

0 commit comments

Comments
 (0)