001/** 002 * 003 * Copyright 2005-2007 Jive Software. 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018package org.jivesoftware.smackx.commands; 019 020/** 021 * Notes can be added to a command execution response. A note has a type and value. 022 * 023 * @author Gabriel Guardincerri 024 */ 025public class AdHocCommandNote { 026 027 private final Type type; 028 private final String value; 029 030 /** 031 * Creates a new adhoc command note with the specified type and value. 032 * 033 * @param type the type of the note. 034 * @param value the value of the note. 035 */ 036 public AdHocCommandNote(Type type, String value) { 037 this.type = type; 038 this.value = value; 039 } 040 041 /** 042 * Returns the value or message of the note. 043 * 044 * @return the value or message of the note. 045 */ 046 public String getValue() { 047 return value; 048 } 049 050 /** 051 * Return the type of the note. 052 * 053 * @return the type of the note. 054 */ 055 public Type getType() { 056 return type; 057 } 058 059 /** 060 * Represents a note type. 061 */ 062 public enum Type { 063 064 /** 065 * The note is informational only. This is not really an exceptional 066 * condition. 067 */ 068 info, 069 070 /** 071 * The note indicates a warning. Possibly due to illogical (yet valid) 072 * data. 073 */ 074 warn, 075 076 /** 077 * The note indicates an error. The text should indicate the reason for 078 * the error. 079 */ 080 error 081 } 082 083}