author | František Kučera <franta-hg@frantovo.cz> |
Fri, 08 May 2020 00:02:05 +0200 | |
changeset 57 | 1b21c78d8706 |
parent 20 | 63b496ae04f9 |
permissions | -rw-r--r-- |
franta-hg@20 | 1 |
package cz.frantovo.langtable; |
franta-hg@20 | 2 |
|
franta-hg@20 | 3 |
import cz.frantovo.langtable.Keyboards.*; |
franta-hg@20 | 4 |
import java.io.File; |
franta-hg@20 | 5 |
import javax.xml.bind.JAXBContext; |
franta-hg@20 | 6 |
import javax.xml.bind.JAXBException; |
franta-hg@20 | 7 |
import javax.xml.bind.Unmarshaller; |
franta-hg@20 | 8 |
|
franta-hg@20 | 9 |
/** |
franta-hg@20 | 10 |
* |
franta-hg@20 | 11 |
* @author Ing. František Kučera (frantovo.cz) |
franta-hg@20 | 12 |
*/ |
franta-hg@20 | 13 |
public class LangTable { |
franta-hg@20 | 14 |
|
franta-hg@20 | 15 |
/** |
franta-hg@20 | 16 |
* @param args the command line arguments |
franta-hg@20 | 17 |
*/ |
franta-hg@20 | 18 |
public static void main(String[] args) throws JAXBException { |
franta-hg@20 | 19 |
|
franta-hg@20 | 20 |
|
franta-hg@20 | 21 |
JAXBContext c = JAXBContext.newInstance(Keyboards.class); |
franta-hg@20 | 22 |
Unmarshaller u = c.createUnmarshaller(); |
franta-hg@20 | 23 |
|
franta-hg@20 | 24 |
long start = System.currentTimeMillis(); |
franta-hg@20 | 25 |
Object o = u.unmarshal(new File("data/keyboards.xml")); |
franta-hg@20 | 26 |
System.out.println("Time: " + (System.currentTimeMillis() - start) + " ms"); |
franta-hg@20 | 27 |
|
franta-hg@20 | 28 |
Keyboards keyboards = (Keyboards) o; |
franta-hg@20 | 29 |
|
franta-hg@20 | 30 |
for (Keyboard k : keyboards.getKeyboards()) { |
franta-hg@20 | 31 |
System.out.println(k.getId()); |
franta-hg@20 | 32 |
System.out.println(" " + k.getDescription()); |
franta-hg@20 | 33 |
System.out.println(" " + k.getComment()); |
franta-hg@20 | 34 |
System.out.println(" " + k.isAscii()); |
franta-hg@20 | 35 |
|
franta-hg@20 | 36 |
System.out.println(" languages: " + k.getLanguages().size()); |
franta-hg@20 | 37 |
for (Language l : k.getLanguages()) { |
franta-hg@20 | 38 |
System.out.println(" " + l); |
franta-hg@20 | 39 |
} |
franta-hg@20 | 40 |
|
franta-hg@20 | 41 |
System.out.println(" territories: " + k.getTerritories().size()); |
franta-hg@20 | 42 |
for (Territory t : k.getTerritories()) { |
franta-hg@20 | 43 |
System.out.println(" " + t); |
franta-hg@20 | 44 |
} |
franta-hg@20 | 45 |
} |
franta-hg@20 | 46 |
|
franta-hg@20 | 47 |
|
franta-hg@20 | 48 |
|
franta-hg@20 | 49 |
|
franta-hg@20 | 50 |
} |
franta-hg@20 | 51 |
} |