From b90fa49ebc5ae54935f16037b62ea24ba7a1941f Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 25 May 2010 14:23:08 +0000 Subject: [PATCH] polishing --- .../scheduling/support/CronTrigger.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/org.springframework.context/src/main/java/org/springframework/scheduling/support/CronTrigger.java b/org.springframework.context/src/main/java/org/springframework/scheduling/support/CronTrigger.java index 37477b40fa..00db793360 100644 --- a/org.springframework.context/src/main/java/org/springframework/scheduling/support/CronTrigger.java +++ b/org.springframework.context/src/main/java/org/springframework/scheduling/support/CronTrigger.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,16 @@ public class CronTrigger implements Trigger { private final CronSequenceGenerator sequenceGenerator; + + /** + * Build a {@link CronTrigger} from the pattern provided in the default time zone. + * @param cronExpression a space-separated list of time fields, + * following cron expression conventions + */ + public CronTrigger(String cronExpression) { + this(cronExpression, TimeZone.getDefault()); + } + /** * Build a {@link CronTrigger} from the pattern provided. * @param cronExpression a space-separated list of time fields, @@ -44,14 +54,6 @@ public class CronTrigger implements Trigger { this.sequenceGenerator = new CronSequenceGenerator(cronExpression, timeZone); } - /** - * Build a {@link CronTrigger} from the pattern provided in the default time zone. - * @param cronExpression a space-separated list of time fields, - * following cron expression conventions - */ - public CronTrigger(String cronExpression) { - this(cronExpression, TimeZone.getDefault()); - } public Date nextExecutionTime(TriggerContext triggerContext) { Date date = triggerContext.lastCompletionTime(); @@ -61,10 +63,11 @@ public class CronTrigger implements Trigger { return this.sequenceGenerator.next(date); } + @Override public boolean equals(Object obj) { - return (this == obj || (obj instanceof CronTrigger && this.sequenceGenerator - .equals(((CronTrigger) obj).sequenceGenerator))); + return (this == obj || (obj instanceof CronTrigger && + this.sequenceGenerator.equals(((CronTrigger) obj).sequenceGenerator))); } @Override