Example #1
0
	public static AddressType fromValue(int v) {
		for (AddressType addrType : AddressType.values()) {
			if (addrType.getValue() == v) {
				return addrType;
			}
		}
		return AddressPreview;
	}
 @Override
 public int hashCode() {
   int result = addressType != null ? addressType.hashCode() : 0;
   result = 31 * result + (streetAddress != null ? streetAddress.hashCode() : 0);
   result = 31 * result + (poBox != null ? poBox.hashCode() : 0);
   result = 31 * result + (unit != null ? unit.hashCode() : 0);
   result = 31 * result + (city != null ? city.hashCode() : 0);
   result = 31 * result + (state != null ? state.hashCode() : 0);
   result = 31 * result + (zip != null ? zip.hashCode() : 0);
   return result;
 }
 private AddressType createWorkAddress() {
   AddressType ab = new AddressType();
   // ab.getAddressLine().add(createSequencedTextType(1, "Line 1"));
   // ab.getAddressLine().add(createSequencedTextType(2, "Line 2"));
   // ab.getAddressLine().add(createSequencedTextType(3, "Line 3"));
   ab.setType("work");
   ab.getLine().add("The Working Co.");
   ab.getLine().add("12 Broad Street");
   ab.setCity("Philadelphia");
   ab.setCountryCode("US");
   ab.setPostalCode("19020-2222");
   return ab;
 }
Example #4
0
 public QOSRule(String rule) throws DataFormatException {
   final int NUMBER_OF_FIELDS = 11;
   if (rule.contains(">")) throw new DataFormatException("rule cannot contain '>' delimiter.");
   String[] fields = rule.split("<");
   if (fields.length != NUMBER_OF_FIELDS)
     throw new DataFormatException(
         "rule does not have " + NUMBER_OF_FIELDS + " fields, it has " + fields.length);
   try {
     _addressType = AddressType.values()[Integer.parseInt(fields[0])];
     _address = fields[1];
     _protocol = Integer.parseInt(fields[2]);
     _portType = PortType.valueOf(fields[3]);
     _port = fields[4];
     _string1 = fields[5];
     _string2 = fields[6];
     _string3 = fields[7];
     _string4 = fields[8];
     _priority = Priority.values()[Integer.parseInt(fields[9]) + 1];
     _comment = fields[10];
   } catch (NumberFormatException ex) {
     throw new DataFormatException("A number was incorrectly formatted: " + ex.getMessage());
   }
 }
Example #5
0
 @Factory("addressTypes")
 public AddressType[] getAddressTypes() {
   return AddressType.values();
 }