1 16 17 package org.apache.axis.constants; 18 19 import org.apache.axis.Constants; 20 21 22 26 public class Use extends Enum { 27 28 32 33 private static final Type type = new Type(); 34 35 public static final String ENCODED_STR = "encoded"; 36 public static final String LITERAL_STR = "literal"; 37 38 public static final Use ENCODED = type.getUse(ENCODED_STR); 39 public static final Use LITERAL = type.getUse(LITERAL_STR); 40 41 public static final Use DEFAULT = ENCODED; 42 43 static { type.setDefault(DEFAULT); } 44 private String encoding; 45 46 public static Use getDefault() { return (Use)type.getDefault(); } 47 48 public final String getEncoding() { return encoding; } 49 50 public static final Use getUse(int style) { 51 return type.getUse(style); 52 } 53 54 public static final Use getUse(String style) { 55 return type.getUse(style); 56 } 57 58 public static final Use getUse(String style, Use dephault) { 59 return type.getUse(style, dephault); 60 } 61 62 public static final boolean isValid(String style) { 63 return type.isValid(style); 64 } 65 66 public static final int size() { 67 return type.size(); 68 } 69 70 public static final String [] getUses() { 71 return type.getEnumNames(); 72 } 73 74 private Object readResolve() throws java.io.ObjectStreamException { 75 return type.getUse(value); 76 } 77 78 public static class Type extends Enum.Type { 79 private Type() { 80 super("style", new Enum [] { 81 new Use(0, ENCODED_STR, 82 Constants.URI_DEFAULT_SOAP_ENC), 83 new Use(1, LITERAL_STR, 84 Constants.URI_LITERAL_ENC), 85 }); 86 } 87 88 public final Use getUse(int style) { 89 return (Use)this.getEnum(style); 90 } 91 92 public final Use getUse(String style) { 93 return (Use)this.getEnum(style); 94 } 95 96 public final Use getUse(String style, Use dephault) { 97 return (Use)this.getEnum(style, dephault); 98 } 99 100 } 101 102 private Use(int value, String name, String encoding) { 103 super(type, value, name); 104 this.encoding = encoding; 105 } 106 107 protected Use() { 108 super(type, DEFAULT.getValue(), DEFAULT.getName()); 109 this.encoding = DEFAULT.getEncoding(); 110 } 111 } 112 | Popular Tags |