1 19 package org.apache.mina.example.haiku; 20 21 25 public class InvalidHaikuException extends Exception { 26 private static final long serialVersionUID = 34877739006797894L; 27 28 private final int position; 29 30 private final String phrase; 31 32 private final int syllableCount; 33 34 private final int expectedSyllableCount; 35 36 public InvalidHaikuException(int position, String phrase, 37 int syllableCount, int expectedSyllableCount) { 38 super("phrase " + position + ", '" + phrase + "' had " + syllableCount 39 + " syllables, not " + expectedSyllableCount); 40 41 this.position = position; 42 this.phrase = phrase; 43 this.syllableCount = syllableCount; 44 this.expectedSyllableCount = expectedSyllableCount; 45 } 46 47 public int getExpectedSyllableCount() { 48 return expectedSyllableCount; 49 } 50 51 public String getPhrase() { 52 return phrase; 53 } 54 55 public int getSyllableCount() { 56 return syllableCount; 57 } 58 59 public int getPhrasePosition() { 60 return position; 61 } 62 } 63 | Popular Tags |