/*
 * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.b2international.snowowl.datastore.server.remotejobs;

import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;

import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;

/**
 */
public class RemoteJobRuleFamily implements Predicate<Job> {

	private final ISchedulingRule rule;

	public static Predicate<Job> create(final ISchedulingRule rule) {
		return Predicates.and(RemoteJobFamily.INSTANCE, new RemoteJobRuleFamily(rule));
	}

	private RemoteJobRuleFamily(final ISchedulingRule rule) {
		Preconditions.checkNotNull(rule, "Scheduling rule may not be null.");
		this.rule = rule;
	}

	public ISchedulingRule getRule() {
		return rule;
	}

	@Override
	public boolean apply(final Job input) {
		return rule.equals(input.getRule());
	}

	@Override
	public int hashCode() {
		return 31 + rule.hashCode();
	}

	@Override
	public boolean equals(final Object obj) {
		if (this == obj) { return true; }
		if (obj == null) { return false; }
		if (!(obj instanceof RemoteJobRuleFamily)) { return false; }
		final RemoteJobRuleFamily other = (RemoteJobRuleFamily) obj;
		return rule.equals(other.rule);
	}

	@Override
	public String toString() {
		final StringBuilder builder = new StringBuilder();
		builder.append("RemoteJobKeyFamily [rule=");
		builder.append(rule);
		builder.append("]");
		return builder.toString();
	}
}

@@ -784,16 +784,55 @@
 s.Job;%0A%0A
+import com.google.common.base.Objects;%0A
 import c
@@ -1925,169 +1925,61 @@
 %7B%0A%09%09
-final StringBuilder builder = new StringBuilder();%0A%09%09builder.append(%22RemoteJobKeyFamily %5Brule=%22);%0A%09%09builder.appen
+return Objects.toStringHelper(this).ad
 d(
+%22
 rule
-);%0A%09%09builder.append(%22%5D%22);%0A%09%09return builder
+%22, rule)
 .toS

Fix output of toString in RemoteJobRuleFamily