* duplicate registration or two different components within the same process trying to register a Candidate.
*/
public class CandidateAlreadyRegisteredException extends Exception {
- private final Entity entity;
- private final EntityOwnershipCandidate registeredCandidate;
+ private static final long serialVersionUID = 1L;
- public CandidateAlreadyRegisteredException(@Nonnull Entity entity,
- @Nonnull EntityOwnershipCandidate registeredCandidate,
- String message) {
- super(message);
- this.entity = Preconditions.checkNotNull(entity, "entity should not be null");
- this.registeredCandidate = Preconditions.checkNotNull(registeredCandidate,
- "registeredCandidate should not be null");
- }
+ private final Entity entity;
- public CandidateAlreadyRegisteredException(@Nonnull Entity entity,
- @Nonnull EntityOwnershipCandidate registeredCandidate,
- String message, Throwable throwable) {
- super(message, throwable);
- this.entity = Preconditions.checkNotNull(entity, "entity should not be null");
- this.registeredCandidate = Preconditions.checkNotNull(registeredCandidate,
- "registeredCandidate should not be null");
+ public CandidateAlreadyRegisteredException(@Nonnull Entity entity) {
+ super(String.format("Candidate has already been registered for %s",
+ Preconditions.checkNotNull(entity, "entity should not be null")));
+ this.entity = entity;
}
/**
public Entity getEntity() {
return entity;
}
-
- /**
- *
- * @return the currently registered candidate
- */
- @Nonnull
- public EntityOwnershipCandidate getRegisteredCandidate() {
- return registeredCandidate;
- }
}