1 58 package org.krysalis.barcode; 59 60 import org.apache.avalon.framework.Enum; 61 62 67 public class ChecksumMode extends Enum { 68 69 70 public static final ChecksumMode CP_AUTO = new ChecksumMode("auto"); 71 72 public static final ChecksumMode CP_IGNORE = new ChecksumMode("ignore"); 73 74 public static final ChecksumMode CP_ADD = new ChecksumMode("add"); 75 78 public static final ChecksumMode CP_CHECK = new ChecksumMode("check"); 79 80 84 protected ChecksumMode(String name) { 85 super(name); 86 } 87 88 93 public static ChecksumMode byName(String name) { 94 if (name.equalsIgnoreCase(ChecksumMode.CP_AUTO.getName())) { 95 return ChecksumMode.CP_AUTO; 96 } else if (name.equalsIgnoreCase(ChecksumMode.CP_IGNORE.getName())) { 97 return ChecksumMode.CP_IGNORE; 98 } else if (name.equalsIgnoreCase(ChecksumMode.CP_ADD.getName())) { 99 return ChecksumMode.CP_ADD; 100 } else if (name.equalsIgnoreCase(ChecksumMode.CP_CHECK.getName())) { 101 return ChecksumMode.CP_CHECK; 102 } else { 103 throw new IllegalArgumentException ("Invalid ChecksumMode: " + name); 104 } 105 } 106 107 } 108 | Popular Tags |