コード例 #1
0
 public static String toPhoneNumberString(PhoneNumber phoneNumber) {
   if (phoneNumber == null) return null;
   StringBuffer buf = new StringBuffer();
   if (phoneNumber.getArea() != null) buf.append("(" + phoneNumber.getArea() + ") ");
   if (phoneNumber.getNumber() != null) {
     buf.append(phoneNumber.getNumber().substring(0, 3) + "-");
     buf.append(phoneNumber.getNumber().substring(3, 7));
     if (phoneNumber.getExtension() != null) buf.append(" " + phoneNumber.getExtension());
   }
   return buf.toString();
 }
コード例 #2
0
 public static PhoneNumber clone(PhoneNumber phoneNumber) {
   if (phoneNumber == null) return null;
   PhoneNumber clone = create();
   clone.setId(ObjectUtil.clone(phoneNumber.getId()));
   clone.setArea(ObjectUtil.clone(phoneNumber.getArea()));
   clone.setNumber(ObjectUtil.clone(phoneNumber.getNumber()));
   clone.setExtension(ObjectUtil.clone(phoneNumber.getExtension()));
   clone.setCountry(phoneNumber.getCountry());
   clone.setType(phoneNumber.getType());
   clone.setValue(ObjectUtil.clone(phoneNumber.getValue()));
   return clone;
 }