V - Type of the view specific for this form component.I - Type of the input that can be presented within the component view.public interface FormComponent<V extends android.view.View,I>
| Modifier and Type | Method and Description |
|---|---|
void |
attachToValidator(FormValidator validator)
Attaches this form component to the given validator.
|
void |
clearError()
Clears the current error (if any) of this form component specified via
setError(CharSequence). |
FormComponent |
findComponent(int componentId)
Looks for a form component with the requested id.
|
int |
getId()
Returns the id of this component.
|
I |
getInput()
Returns the current input presented by an attached view of this form component.
|
V |
getView()
Returns the view attached to this form component.
|
boolean |
hasError()
Checks whether this form component has error specified or not.
|
boolean |
hasInputChanged()
Checks whether the current value of this form component has changed since its last validation.
|
void |
setError(CharSequence errorMessage)
Sets an error for this form component.
|
boolean |
validate()
Runs validation process of this form component.
|
void attachToValidator(@NonNull
FormValidator validator)
validator - An instance of FormValidator with which is this form component associated.boolean hasInputChanged()
Basically, whenever this returns true this component should be validated, otherwise
there is no need given the fact that its value did not change.
True if the current value is different from the one that has been last time
validated via validate(), false otherwise.boolean validate()
True if the current state of this form component's view is valid,
false otherwise.int getId()
@Nullable V getView()
@NonNull I getInput()
void setError(@NonNull
CharSequence errorMessage)
Note, that a specific implementations can ignore this call and also depends on the specific implementation how the requested error parameter will be shown.
errorMessage - The desired error message.clearError()boolean hasError()
True if error has been specified via setError(CharSequence),
false if not or has been cleared via clearError().void clearError()
setError(CharSequence).@Nullable FormComponent findComponent(int componentId)
componentId - Id of the desired component to find.null if component with such a
componentId was not found.