author | Jaroslav Tulach <jtulach@netbeans.org> |
Sat, 14 Jun 2008 10:07:02 +0200 | |
changeset 223 | 74232660cfff |
parent 222 | def08b238fa5 |
child 224 | 7a15b5efae6a |
permissions | -rw-r--r-- |
jtulach@223 | 1 |
package org.apidesign.anagram.app.property; |
jtulach@221 | 2 |
|
jtulach@221 | 3 |
import org.apidesign.anagram.api.Scrambler; |
jtulach@221 | 4 |
import org.apidesign.anagram.api.WordLibrary; |
jtulach@221 | 5 |
import org.apidesign.anagram.gui.Anagrams; |
jtulach@221 | 6 |
|
jtulach@221 | 7 |
public final class AnagramsWithProperties extends Anagrams { |
jtulach@221 | 8 |
private WordLibrary wordLibrary; |
jtulach@221 | 9 |
private Scrambler scrambler; |
jtulach@221 | 10 |
|
jtulach@221 | 11 |
public AnagramsWithProperties() { |
jtulach@221 | 12 |
} |
jtulach@221 | 13 |
|
jtulach@221 | 14 |
@Override |
jtulach@221 | 15 |
protected WordLibrary getWordLibrary() { |
jtulach@221 | 16 |
try { |
jtulach@221 | 17 |
if (wordLibrary == null) { |
jtulach@222 | 18 |
String implName = System.getProperty("org.apidesign.anagram.api.WordLibrary"); |
jtulach@222 | 19 |
assert implName != null; |
jtulach@222 | 20 |
Class<?> impl = Class.forName(implName); |
jtulach@222 | 21 |
wordLibrary = (WordLibrary)impl.newInstance(); |
jtulach@221 | 22 |
} |
jtulach@221 | 23 |
return wordLibrary; |
jtulach@221 | 24 |
} catch (Exception ex) { |
jtulach@221 | 25 |
throw new IllegalStateException(ex); |
jtulach@221 | 26 |
} |
jtulach@221 | 27 |
} |
jtulach@221 | 28 |
|
jtulach@221 | 29 |
@Override |
jtulach@221 | 30 |
protected Scrambler getScrambler() { |
jtulach@221 | 31 |
try { |
jtulach@221 | 32 |
if (scrambler == null) { |
jtulach@222 | 33 |
String implName = System.getProperty("org.apidesign.anagram.api.Scrambler"); |
jtulach@222 | 34 |
assert implName != null; |
jtulach@222 | 35 |
Class<?> impl = Class.forName(implName); |
jtulach@222 | 36 |
scrambler = (Scrambler)impl.newInstance(); |
jtulach@221 | 37 |
} |
jtulach@221 | 38 |
return scrambler; |
jtulach@221 | 39 |
} catch (Exception ex) { |
jtulach@221 | 40 |
throw new IllegalStateException(ex); |
jtulach@221 | 41 |
} |
jtulach@221 | 42 |
} |
jtulach@221 | 43 |
} |