Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.

Commit 376a987

Browse files
author
John Cordeiro
committed
Refactor validate method with multiple views to support any view child
1 parent e96e858 commit 376a987

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

library/src/main/java/br/com/ilhasoft/support/validation/Validator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public boolean validate(View view) {
4040
return isAllViewsValid(viewWithValidations);
4141
}
4242

43-
public boolean validate(List<View> views) {
43+
public <ViewType extends View> boolean validate(List<ViewType> views) {
4444
List<View> viewWithValidations = getViewsWithValidation(views);
4545
return isAllViewsValid(viewWithValidations);
4646
}
@@ -89,7 +89,7 @@ private List<View> getViewsWithValidation() {
8989
return Collections.singletonList(target.getRoot());
9090
}
9191

92-
private List<View> getViewsWithValidation(List<View> views) {
92+
private <ViewType extends View> List<View> getViewsWithValidation(List<ViewType> views) {
9393
return ViewTagHelper.filterViewsWithTag(R.id.validator_rule, views);
9494
}
9595

library/src/main/java/br/com/ilhasoft/support/validation/util/ViewTagHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static List<View> filterViewWithTag(int tagId, View view) {
4141
return viewsWithTags;
4242
}
4343

44-
public static List<View> filterViewsWithTag(int tagId, List<View> views) {
44+
public static <ViewType extends View> List<View> filterViewsWithTag(int tagId, List<ViewType> views) {
4545
List<View> viewsWithTags = new ArrayList<>();
4646
for (View view : views) {
4747
addViewWhenContainsTag(tagId, viewsWithTags, view);

0 commit comments

Comments
 (0)