001 // This file is part of AceWiki. 002 // Copyright 2008-2012, AceWiki developers. 003 // 004 // AceWiki is free software: you can redistribute it and/or modify it under the terms of the GNU 005 // Lesser General Public License as published by the Free Software Foundation, either version 3 of 006 // the License, or (at your option) any later version. 007 // 008 // AceWiki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 010 // Lesser General Public License for more details. 011 // 012 // You should have received a copy of the GNU Lesser General Public License along with AceWiki. If 013 // not, see http://www.gnu.org/licenses/. 014 015 package ch.uzh.ifi.attempto.acewiki.core; 016 017 /** 018 * This class represents a detail of a lexical entry as shown to the user. For example, the plural 019 * form of a noun would be such a detail. 020 * 021 * @author Tobias Kuhn 022 */ 023 public class LexiconDetail { 024 025 private String name; 026 private String description; 027 private Object value; 028 private boolean required; 029 030 /** 031 * Creates a lexical detail object. 032 * 033 * @param name The name of the detail as shown to the user. 034 * @param description The description shown to the user. 035 * @param value The value, either a String or a Boolean. 036 * @param required Whether the detail is required or not. 037 */ 038 public LexiconDetail(String name, String description, Object value, boolean required) { 039 if (value == null) value = ""; 040 this.name = name; 041 this.description = description; 042 this.value = value; 043 this.required = required; 044 } 045 046 /** 047 * Creates a required lexical detail object. 048 * 049 * @param name The name of the detail as shown to the user. 050 * @param description The description shown to the user. 051 * @param value The value, either a String or a Boolean. 052 */ 053 public LexiconDetail(String name, String description, Object value) { 054 this(name, description, value, true); 055 } 056 057 /** 058 * Creates a required lexical detail object without description. 059 * 060 * @param name The name of the detail as shown to the user. 061 * @param value The value, either a String or a Boolean. 062 */ 063 public LexiconDetail(String name, Object value) { 064 this(name, "", value, true); 065 } 066 067 /** 068 * Returns the name of this lexical detail. 069 * 070 * @return The name. 071 */ 072 public String getName() { 073 return name; 074 } 075 076 /** 077 * Returns the description of this lexical detail. 078 * 079 * @return The description. 080 */ 081 public String getDescription() { 082 return description; 083 } 084 085 /** 086 * Returns the value of this lexical detail, either a String or a Boolean. 087 * 088 * @return The value. 089 */ 090 public Object getValue() { 091 return value; 092 } 093 094 /** 095 * Returns whether this lexical detail is required or not. 096 * 097 * @return true if this lexical detail is required. 098 */ 099 public boolean isRequired() { 100 return required; 101 } 102 103 }