java/LangTable/src/cz/frantovo/langtable/Keyboards.java
author František Kučera <franta-hg@frantovo.cz>
Tue, 09 Sep 2014 14:51:08 +0200
changeset 21 627912dacae3
parent 20 63b496ae04f9
permissions -rw-r--r--
RAII v Javě pomocí try+AutoCloseable
     1 package cz.frantovo.langtable;
     2 
     3 import java.util.List;
     4 import javax.xml.bind.annotation.XmlElement;
     5 import javax.xml.bind.annotation.XmlElementWrapper;
     6 import javax.xml.bind.annotation.XmlRootElement;
     7 
     8 /**
     9  *
    10  * @author Ing. František Kučera (frantovo.cz)
    11  */
    12 @XmlRootElement
    13 public class Keyboards {
    14 
    15 	private List<Keyboard> keyboards;
    16 
    17 	@XmlElement(name = "keyboard")
    18 	public List<Keyboard> getKeyboards() {
    19 		return keyboards;
    20 	}
    21 
    22 	public void setKeyboards(List<Keyboard> keyboards) {
    23 		this.keyboards = keyboards;
    24 	}
    25 
    26 	public static class Keyboard {
    27 
    28 		private String id;
    29 		private String description;
    30 		private String comment;
    31 		private boolean ascii;
    32 		private List<Language> languages;
    33 		private List<Territory> territories;
    34 
    35 		@XmlElement(name = "keyboardId")
    36 		public String getId() {
    37 			return id;
    38 		}
    39 
    40 		public void setId(String id) {
    41 			this.id = id;
    42 		}
    43 
    44 		@XmlElement
    45 		public String getDescription() {
    46 			return description;
    47 		}
    48 
    49 		public void setDescription(String description) {
    50 			this.description = description;
    51 		}
    52 
    53 		@XmlElement
    54 		public String getComment() {
    55 			return comment;
    56 		}
    57 
    58 		public void setComment(String comment) {
    59 			this.comment = comment;
    60 		}
    61 
    62 		@XmlElement
    63 		public boolean isAscii() {
    64 			return ascii;
    65 		}
    66 
    67 		public void setAscii(boolean ascii) {
    68 			this.ascii = ascii;
    69 		}
    70 
    71 		@XmlElement(name = "language")
    72 		@XmlElementWrapper(name = "languages")
    73 		public List<Language> getLanguages() {
    74 			return languages;
    75 		}
    76 
    77 		public void setLanguages(List<Language> languages) {
    78 			this.languages = languages;
    79 		}
    80 
    81 		@XmlElement(name = "territory")
    82 		@XmlElementWrapper(name = "territories")
    83 		public List<Territory> getTerritories() {
    84 			return territories;
    85 		}
    86 
    87 		public void setTerritories(List<Territory> territories) {
    88 			this.territories = territories;
    89 		}
    90 	}
    91 
    92 	public static class Language {
    93 
    94 		private String id;
    95 		private int rank;
    96 
    97 		@XmlElement(name = "languageId")
    98 		public String getId() {
    99 			return id;
   100 		}
   101 
   102 		public void setId(String id) {
   103 			this.id = id;
   104 		}
   105 
   106 		@XmlElement
   107 		public int getRank() {
   108 			return rank;
   109 		}
   110 
   111 		public void setRank(int rank) {
   112 			this.rank = rank;
   113 		}
   114 
   115 		@Override
   116 		public String toString() {
   117 			return getId() + " (" + getRank() + ")";
   118 		}
   119 	}
   120 
   121 	public static class Territory {
   122 
   123 		private String id;
   124 		private int rank;
   125 
   126 		@XmlElement(name = "territoryId")
   127 		public String getId() {
   128 			return id;
   129 		}
   130 
   131 		public void setId(String id) {
   132 			this.id = id;
   133 		}
   134 
   135 		@XmlElement
   136 		public int getRank() {
   137 			return rank;
   138 		}
   139 
   140 		public void setRank(int rank) {
   141 			this.rank = rank;
   142 		}
   143 
   144 		@Override
   145 		public String toString() {
   146 			return getId() + " (" + getRank() + ")";
   147 		}
   148 	}
   149 }