Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tminglei committed Oct 9, 2014
1 parent 4fdf893 commit 51bd2b7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ Features
- immutable, you can share mapping definition object safely


Usage & desc
Usage & Desc
-------------
![form-binder description](https://github.com/tminglei/form-binder/raw/master/form-binder-desc.png)

#### Major components:
#### Major Components:
[1] **binder**: facade, two major methods: `bind`, `validate`
[2] **messages**: `(String) => String`, *(messageKey) => message*
[3] **mapping**: used to validate/convert data
Expand All @@ -40,15 +40,15 @@ binder **validate**, _validate only_ and not consume converted data, method sign
def validate[T](mapping: Mapping[T], data: Map[String, String], touched: Option[Seq[String]] = None)
```

#### Extention points:
#### Extension Points:
(1) **BulkPreProcessor**: `(Map[String, String]) => Map[String, String]`, *data => data*
(2) **PostErrProcessor**: `(Seq[(String, String)]) => R`, *errors => R*
(3) **TouchedExtractor**: `(Map[String, String]) => Seq[String]`, *data => touched items*
(4) **PreProcessor**: `(String) => String`, *(input) => output*
(5) **Constraint**: `(String, String, Messages) => Option[String]`, *(label, vString, messages) => [error]*
(6) **ExtraConstraint**: `(String, T, Messages) => Seq[(String, String)]`, *(label, vObject, messages) => errors*

#### Options and others:
#### Options & Others:
1) **label**: `feature`, readable name for current group/field
2) **mapTo**: `feature`, map converted value to another type
3) **eagerCheck**: `option`, check errors as more as possiable
Expand All @@ -58,7 +58,7 @@ def validate[T](mapping: Mapping[T], data: Map[String, String], touched: Option[
_* By default, form-binder would return when encountered a validation error._
_** ignoreEmpty + touched, will let form-binder re-check touched empty field/values_

For more `form-binder` details, pls check the [codes](https://github.com/tminglei/form-binder/tree/master/src/main/scala/com/github/tminglei/bind) and [tests](https://github.com/tminglei/form-binder/tree/master/src/test/scala/com/github/tminglei/bind).
For `form-binder` more details, pls check the [codes](https://github.com/tminglei/form-binder/tree/master/src/main/scala/com/github/tminglei/bind) and [tests](https://github.com/tminglei/form-binder/tree/master/src/test/scala/com/github/tminglei/bind).
For `form-binder`/`Scalatra` integration, pls see [here](https://github.com/tminglei/form-binder/tree/master/integrations/scalatra).


Expand Down

0 comments on commit 51bd2b7

Please sign in to comment.