1 22 23 package org.jboss.tutorial.spring; 24 25 28 public class RandomFileWordsCreator extends FileLineReader 29 { 30 31 private IntCreator intCreator; 32 33 public IntCreator getIntCreator() 34 { 35 return intCreator; 36 } 37 38 public void setIntCreator(IntCreator intCreator) 39 { 40 this.intCreator = intCreator; 41 } 42 43 public void afterPropertiesSet() throws Exception 44 { 45 super.afterPropertiesSet(); 46 if (getIntCreator() == null) 47 { 48 throw new IllegalArgumentException ("IntCreatot must be set!"); 49 } 50 } 51 52 protected String getNext() 53 { 54 return words.get(getIntCreator().createInt(words.size())); 55 } 56 57 } 58 | Popular Tags |