Make field private and provide a getter.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1477274 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e55db317f2
commit
6594da9e36
|
@ -50,6 +50,6 @@ public class DeleteCommand<T> extends EditCommand<T> {
|
|||
*/
|
||||
@Override
|
||||
public void accept(final CommandVisitor<T> visitor) {
|
||||
visitor.visitDeleteCommand(object);
|
||||
visitor.visitDeleteCommand(getObject());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,9 @@ package org.apache.commons.collections4.comparators.sequence;
|
|||
*/
|
||||
public abstract class EditCommand<T> {
|
||||
|
||||
/** Object on which the command should be applied. */
|
||||
private T object;
|
||||
|
||||
/**
|
||||
* Simple constructor. Creates a new instance of EditCommand
|
||||
*
|
||||
|
@ -57,6 +60,15 @@ public abstract class EditCommand<T> {
|
|||
this.object = object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the object associated with this command.
|
||||
*
|
||||
* @return the object on which the command is applied
|
||||
*/
|
||||
protected T getObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept a visitor.
|
||||
* <p>
|
||||
|
@ -67,7 +79,4 @@ public abstract class EditCommand<T> {
|
|||
*/
|
||||
public abstract void accept(CommandVisitor<T> visitor);
|
||||
|
||||
/** Object on which the command should be applied. */
|
||||
protected T object;
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class InsertCommand<T> extends EditCommand<T> {
|
|||
*/
|
||||
@Override
|
||||
public void accept(final CommandVisitor<T> visitor) {
|
||||
visitor.visitInsertCommand(object);
|
||||
visitor.visitInsertCommand(getObject());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,6 +52,6 @@ public class KeepCommand<T> extends EditCommand<T> {
|
|||
*/
|
||||
@Override
|
||||
public void accept(final CommandVisitor<T> visitor) {
|
||||
visitor.visitKeepCommand(object);
|
||||
visitor.visitKeepCommand(getObject());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue