blob: 10dedbead88fa3a418c81a866afd9f94a0637171 [file] [log] [blame]
Shuyi Chend7955ce2013-05-22 14:51:55 -07001/**
2 * $RCSfile$
3 * $Revision$
4 * $Date$
5 *
6 * Copyright 2005-2007 Jive Software.
7 *
8 * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21package org.jivesoftware.smackx.commands;
22
23/**
24 * Notes can be added to a command execution response. A note has a type and value.
25 *
26 * @author Gabriel Guardincerri
27 */
28public class AdHocCommandNote {
29
30 private Type type;
31 private String value;
32
33 /**
34 * Creates a new adhoc command note with the specified type and value.
35 *
36 * @param type the type of the note.
37 * @param value the value of the note.
38 */
39 public AdHocCommandNote(Type type, String value) {
40 this.type = type;
41 this.value = value;
42 }
43
44 /**
45 * Returns the value or message of the note.
46 *
47 * @return the value or message of the note.
48 */
49 public String getValue() {
50 return value;
51 }
52
53 /**
54 * Return the type of the note.
55 *
56 * @return the type of the note.
57 */
58 public Type getType() {
59 return type;
60 }
61
62 /**
63 * Represents a note type.
64 */
65 public enum Type {
66
67 /**
68 * The note is informational only. This is not really an exceptional
69 * condition.
70 */
71 info,
72
73 /**
74 * The note indicates a warning. Possibly due to illogical (yet valid)
75 * data.
76 */
77 warn,
78
79 /**
80 * The note indicates an error. The text should indicate the reason for
81 * the error.
82 */
83 error
84 }
85
86}