Skip to content

Commit

Permalink
Use generics
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed Jul 15, 2020
1 parent 430f788 commit 484305a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
10 changes: 2 additions & 8 deletions src/main/java/net/fortuna/ical4j/model/component/VTimeZone.java
Expand Up @@ -133,7 +133,7 @@ public class VTimeZone extends CalendarComponent {

private static final long serialVersionUID = 5629679741050917815L;

private final Validator itipValidator = new VTimeZoneValidator();
private final Validator<VTimeZone> itipValidator = new VTimeZoneValidator();

private final Validator<VTimeZone> validator = new ComponentValidator<>(
new ValidationRule<>(One, TZID),
Expand Down Expand Up @@ -241,13 +241,7 @@ public final void validate(final boolean recurse) throws ValidationException {

@Override
public void validate(Method method) throws ValidationException {
}

/**
* {@inheritDoc}
*/
protected Validator<CalendarComponent> getValidator(Method method) {
return itipValidator;
itipValidator.validate(this);
}

/**
Expand Down
Expand Up @@ -15,16 +15,16 @@
public class VEventValidator extends ComponentValidator<VEvent> {

private final Validator<VAlarm> itipValidator = new ComponentValidator<>(
new ValidationRule(One, ACTION, TRIGGER),
new ValidationRule(OneOrLess, DESCRIPTION, DURATION, REPEAT, SUMMARY));
new ValidationRule<>(One, ACTION, TRIGGER),
new ValidationRule<>(OneOrLess, DESCRIPTION, DURATION, REPEAT, SUMMARY));

private final boolean alarmsAllowed;

public VEventValidator(ValidationRule... rules) {
public VEventValidator(ValidationRule<VEvent>... rules) {
this(true, rules);
}

public VEventValidator(boolean alarmsAllowed, ValidationRule... rules) {
public VEventValidator(boolean alarmsAllowed, ValidationRule<VEvent>... rules) {
super(rules);
this.alarmsAllowed = alarmsAllowed;
}
Expand Down
Expand Up @@ -14,10 +14,10 @@
public class VTimeZoneValidator extends ComponentValidator<VTimeZone> {

private final Validator<Observance> itipValidator = new ComponentValidator<>(
new ValidationRule(One, DTSTART, TZOFFSETFROM, TZOFFSETTO),
new ValidationRule(OneOrLess, TZNAME));
new ValidationRule<>(One, DTSTART, TZOFFSETFROM, TZOFFSETTO),
new ValidationRule<>(OneOrLess, TZNAME));

public VTimeZoneValidator(ValidationRule... rules) {
public VTimeZoneValidator(ValidationRule<VTimeZone>... rules) {
super(rules);
}

Expand Down
Expand Up @@ -15,16 +15,16 @@
public class VToDoValidator extends ComponentValidator<VToDo> {

private final Validator<VAlarm> itipValidator = new ComponentValidator<>(
new ValidationRule(One, ACTION, TRIGGER),
new ValidationRule(OneOrLess, DESCRIPTION, DURATION, REPEAT, SUMMARY));
new ValidationRule<>(One, ACTION, TRIGGER),
new ValidationRule<>(OneOrLess, DESCRIPTION, DURATION, REPEAT, SUMMARY));

private final boolean alarmsAllowed;

public VToDoValidator(ValidationRule... rules) {
public VToDoValidator(ValidationRule<VToDo>... rules) {
this(true, rules);
}

public VToDoValidator(boolean alarmsAllowed, ValidationRule... rules) {
public VToDoValidator(boolean alarmsAllowed, ValidationRule<VToDo>... rules) {
super(rules);
this.alarmsAllowed = alarmsAllowed;
}
Expand Down

0 comments on commit 484305a

Please sign in to comment.