Skip to content

Commit

Permalink
update doxs
Browse files Browse the repository at this point in the history
  • Loading branch information
eddmash committed Nov 23, 2017
1 parent d43617d commit 523e9ee
Show file tree
Hide file tree
Showing 29 changed files with 77 additions and 327 deletions.
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,45 @@ Using this library boils down to this steps
validator.addCheck(new NotEmptyCheck(nameEditText, "name cannot be blank");
validator.addCheck(new NotEmptyCheck(ageSpinner, "age cannot be blank");
```
`Learn more about available checks <com/eddmash/validation/checks/package-index>`
[Learn more about available checks](http://android-validation-library.readthedocs.io/en/latest/checks.html)

- Validate and Handle the errors
- Validate

The final step is telling the validator to validate againsts our checks

To run the validations invole the validators
`validate() <ValidatorInterface.validate()>` method.
```
validator.validate().
```

This method returns ``true`` if the validation passed or ``false`` if the validations failed.

Handling Errors
---------------

Incase of validation failure, the validation errors can be accessed via the
`getErrors() <ValidatorInterface.getErrors()>` method.

This library comes with a convenience `ErrorRenderer <ErrorRenderer>`, which can be used
to easily display the validation errors.
This library comes with a convenience class
[ErrorRenderer](http://android-validation-library.readthedocs.io/en/latest/renderer.html), which
can be used to easily display the validation errors.

```
// the layout where we display any validation errors
LinearLayout errorSpace = (LinearLayout) findViewById(R.id.error_base);
errorSpace.removeAllViews();// clear space first
if (validator.validate()) {
// .. code to perform if validation passes
} else {
// show the errors if validation failed
// we use the renderer class to handle the display
ErrorRenderer errorRenderer = new ErrorRenderer(this, validator);
errorRenderer.render(errorSpace);
}
```
```

30 changes: 0 additions & 30 deletions docs/source/com/eddmash/validation/ExampleInstrumentedTest.rst

This file was deleted.

22 changes: 0 additions & 22 deletions docs/source/com/eddmash/validation/ExampleUnitTest.rst

This file was deleted.

5 changes: 0 additions & 5 deletions docs/source/com/eddmash/validation/ValidationListener.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ ValidationListener

Methods
-------
onValidationFailed
^^^^^^^^^^^^^^^^^^

.. java:method:: void onValidationFailed()
:outertype: ValidationListener

Invoked when validation failed

onValidationSuccess
^^^^^^^^^^^^^^^^^^^

.. java:method:: void onValidationSuccess()
:outertype: ValidationListener

Expand Down
34 changes: 0 additions & 34 deletions docs/source/com/eddmash/validation/Validator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,79 +26,45 @@ Validator
Constructors
------------
Validator
^^^^^^^^^

.. java:constructor:: public Validator(Activity context)
:outertype: Validator

Validator
^^^^^^^^^

.. java:constructor:: public Validator(String tag, Activity context)
:outertype: Validator

Methods
-------
addCheck
^^^^^^^^

.. java:method:: @Override public void addCheck(ValidationCheck validationCheck)
:outertype: Validator

addValidator
^^^^^^^^^^^^

.. java:method:: @Override public void addValidator(ValidatorInterface validator)
:outertype: Validator

clearErrors
^^^^^^^^^^^

.. java:method:: @Override public void clearErrors()
:outertype: Validator

disableCheck
^^^^^^^^^^^^

.. java:method:: @Override public void disableCheck(ValidationCheck validationCheck)
:outertype: Validator

\ :java:ref:`see <ValidatorInterface.addCheck(ValidationCheck)>`\

disableValidator
^^^^^^^^^^^^^^^^

.. java:method:: @Override public void disableValidator(ValidatorInterface validatorInterface)
:outertype: Validator

getErrors
^^^^^^^^^

.. java:method:: @Override public Map<String, List> getErrors()
:outertype: Validator

getErrorsByTag
^^^^^^^^^^^^^^

.. java:method:: @Override public List getErrorsByTag(String tag)
:outertype: Validator

toString
^^^^^^^^

.. java:method:: @Override public String toString()
:outertype: Validator

validate
^^^^^^^^

.. java:method:: @Override public boolean validate()
:outertype: Validator

validate
^^^^^^^^

.. java:method:: @Override public void validate(ValidationListener validationListener)
:outertype: Validator

26 changes: 0 additions & 26 deletions docs/source/com/eddmash/validation/ValidatorInterface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ ValidatorInterface
Methods
-------
addCheck
^^^^^^^^

.. java:method:: void addCheck(ValidationCheck validationCheck)
:outertype: ValidatorInterface
Expand All @@ -24,47 +22,32 @@ addCheck

:param validationCheck:

addValidator
^^^^^^^^^^^^

.. java:method:: void addValidator(ValidatorInterface validatorInterface)
:outertype: ValidatorInterface

Add another validator to validated at the time this one is being validated.

:param validatorInterface: the validatorInterface object

clearErrors
^^^^^^^^^^^

.. java:method:: void clearErrors()
:outertype: ValidatorInterface

Clear all the errors from the validator. maybe use when you have already run the validation onces and want to run the validation again using the same ValidatorInterface instance

disableCheck
^^^^^^^^^^^^

.. java:method:: void disableCheck(ValidationCheck validationCheck)
:outertype: ValidatorInterface

disable validation check

:param validationCheck: the validation check to disable.

disableValidator
^^^^^^^^^^^^^^^^

.. java:method:: void disableValidator(ValidatorInterface validatorInterface)
:outertype: ValidatorInterface

Disable the validator from being validated any more.

:param validatorInterface: validatorInterface object

getErrors
^^^^^^^^^

.. java:method:: Map<String, List> getErrors()
:outertype: ValidatorInterface

Expand All @@ -74,29 +57,20 @@ getErrors

:return: Map

getErrorsByTag
^^^^^^^^^^^^^^

.. java:method:: List getErrorsByTag(String tag)
:outertype: ValidatorInterface

Gets a list of errors for a specific tag.

:param tag:

validate
^^^^^^^^

.. java:method:: boolean validate()
:outertype: ValidatorInterface

Does the actual validation.

:return: boolean true of valid

validate
^^^^^^^^

.. java:method:: void validate(ValidationListener validationListener)
:outertype: ValidatorInterface

Expand Down
4 changes: 0 additions & 4 deletions docs/source/com/eddmash/validation/checks/AllCheck.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@ AllCheck

Constructors
------------
AllCheck
^^^^^^^^

.. java:constructor:: public AllCheck(String errorMessage)
:outertype: AllCheck

Methods
-------
validate
^^^^^^^^

.. java:method:: @Override protected boolean validate()
:outertype: AllCheck
Expand Down
4 changes: 0 additions & 4 deletions docs/source/com/eddmash/validation/checks/AnyCheck.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@ AnyCheck

Constructors
------------
AnyCheck
^^^^^^^^

.. java:constructor:: public AnyCheck(String errorMessage)
:outertype: AnyCheck

Methods
-------
validate
^^^^^^^^

.. java:method:: @Override protected boolean validate()
:outertype: AnyCheck
Expand Down
21 changes: 0 additions & 21 deletions docs/source/com/eddmash/validation/checks/CheckCompound.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,55 +16,34 @@ CheckCompound
Fields
------
checkList
^^^^^^^^^

.. java:field:: protected List<ValidationCheck> checkList
:outertype: CheckCompound

Constructors
------------
CheckCompound
^^^^^^^^^^^^^

.. java:constructor:: public CheckCompound(String errorMessage)
:outertype: CheckCompound

Methods
-------
addCheck
^^^^^^^^

.. java:method:: public void addCheck(ValidationCheck validationCheck)
:outertype: CheckCompound

addChecks
^^^^^^^^^

.. java:method:: public void addChecks(List<ValidationCheck> validationChecks)
:outertype: CheckCompound

getErrorMsg
^^^^^^^^^^^

.. java:method:: @Override public String getErrorMsg()
:outertype: CheckCompound

run
^^^

.. java:method:: @Override public boolean run()
:outertype: CheckCompound

setError
^^^^^^^^

.. java:method:: @Override public void setError(String error)
:outertype: CheckCompound

validate
^^^^^^^^

.. java:method:: protected abstract boolean validate()
:outertype: CheckCompound

0 comments on commit 523e9ee

Please sign in to comment.