Last change
on this file since 914 was
766,
checked in by sherbold, 12 years ago
|
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.0 KB
|
Line | |
---|
1 | package de.ugoe.cs.quest.commands.misc;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 |
|
---|
5 | import de.ugoe.cs.quest.CommandHelpers;
|
---|
6 | import de.ugoe.cs.util.console.Command;
|
---|
7 | import de.ugoe.cs.util.console.GlobalDataContainer;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * <p>
|
---|
11 | * Command to delete object from {@link GlobalDataContainer}.
|
---|
12 | * </p>
|
---|
13 | *
|
---|
14 | * @author Steffen Herbold
|
---|
15 | * @version 1.0
|
---|
16 | */
|
---|
17 | public class CMDdeleteObject implements Command {
|
---|
18 |
|
---|
19 | /*
|
---|
20 | * (non-Javadoc)
|
---|
21 | *
|
---|
22 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
23 | */
|
---|
24 | @Override
|
---|
25 | public String help() {
|
---|
26 | return "deleteObject <objectname>";
|
---|
27 | }
|
---|
28 |
|
---|
29 | /*
|
---|
30 | * (non-Javadoc)
|
---|
31 | *
|
---|
32 | * @see de.ugoe.cs.util.console.Command#run(java.util.List)
|
---|
33 | */
|
---|
34 | @Override
|
---|
35 | public void run(List<Object> parameters) {
|
---|
36 | String objectName;
|
---|
37 | try {
|
---|
38 | objectName = (String) parameters.get(0);
|
---|
39 | } catch (Exception e) {
|
---|
40 | throw new IllegalArgumentException();
|
---|
41 | }
|
---|
42 | boolean deleted = GlobalDataContainer.getInstance().removeData(
|
---|
43 | objectName);
|
---|
44 | if (!deleted) {
|
---|
45 | CommandHelpers.objectNotFoundMessage(objectName);
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.