From 1f0624db7c6550bcb5414014b633936547d7704f Mon Sep 17 00:00:00 2001 From: Bernard Labno Date: Tue, 3 Jul 2012 14:12:15 +0000 Subject: [PATCH] Make command more extendable (Commander interface). --- src/main/java/pl/com/it_crowd/youtrack/api/Command.java | 4 ++-- src/main/java/pl/com/it_crowd/youtrack/api/Commander.java | 7 +++++++ src/main/java/pl/com/it_crowd/youtrack/api/defaults/Fields.java | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 src/main/java/pl/com/it_crowd/youtrack/api/Commander.java diff --git a/src/main/java/pl/com/it_crowd/youtrack/api/Command.java b/src/main/java/pl/com/it_crowd/youtrack/api/Command.java index 83d45e8..d2d2c06 100644 --- a/src/main/java/pl/com/it_crowd/youtrack/api/Command.java +++ b/src/main/java/pl/com/it_crowd/youtrack/api/Command.java @@ -59,9 +59,9 @@ public class Command { return state(state.getCommandValue()); } - private Command command(Fields command, String argument) + protected Command command(Commander commander, String argument) { - this.command.append(" ").append(command.getCommand()).append(" ").append(argument); + this.command.append(" ").append(commander.getCommand()).append(" ").append(argument); return this; } } diff --git a/src/main/java/pl/com/it_crowd/youtrack/api/Commander.java b/src/main/java/pl/com/it_crowd/youtrack/api/Commander.java new file mode 100644 index 0000000..cc88b98 --- /dev/null +++ b/src/main/java/pl/com/it_crowd/youtrack/api/Commander.java @@ -0,0 +1,7 @@ +package pl.com.it_crowd.youtrack.api; + +public interface Commander { +// -------------------------- OTHER METHODS -------------------------- + + String getCommand(); +} diff --git a/src/main/java/pl/com/it_crowd/youtrack/api/defaults/Fields.java b/src/main/java/pl/com/it_crowd/youtrack/api/defaults/Fields.java index ec7b932..ad02a7b 100644 --- a/src/main/java/pl/com/it_crowd/youtrack/api/defaults/Fields.java +++ b/src/main/java/pl/com/it_crowd/youtrack/api/defaults/Fields.java @@ -1,6 +1,8 @@ package pl.com.it_crowd.youtrack.api.defaults; -public enum Fields { +import pl.com.it_crowd.youtrack.api.Commander; + +public enum Fields implements Commander { assignee, issueId("issue id"), state, -- libgit2 0.24.0