/** * Constructs a contact initialized to the specified online resource. * * @param resource the on-line information that can be used to contact the individual or organization, * or {@code null} if none. */ public DefaultContact(final OnlineResource resource) { this.onlineResources = singleton(resource, OnlineResource.class); }
/** * Constructs a contact initialized to the specified online resource. * * @param resource the on-line information that can be used to contact the individual or organization, * or {@code null} if none. */ public DefaultContact(final OnlineResource resource) { this.onlineResources = singleton(resource, OnlineResource.class); }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(Contact) */ public DefaultContact(final Contact object) { super(object); if (object != null) { hoursOfService = object.getHoursOfService(); contactInstructions = object.getContactInstructions(); if (object instanceof DefaultContact) { final DefaultContact c = (DefaultContact) object; phones = copyCollection(c.getPhones(), Telephone.class); addresses = copyCollection(c.getAddresses(), Address.class); onlineResources = copyCollection(c.getOnlineResources(), OnlineResource.class); contactType = c.getContactType(); } else { phones = singleton(object.getPhone(), Telephone.class); addresses = singleton(object.getAddress(), Address.class); onlineResources = singleton(object.getOnlineResource(), OnlineResource.class); } } }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(Contact) */ public DefaultContact(final Contact object) { super(object); if (object != null) { hoursOfService = object.getHoursOfService(); contactInstructions = object.getContactInstructions(); if (object instanceof DefaultContact) { final DefaultContact c = (DefaultContact) object; phones = copyCollection(c.getPhones(), Telephone.class); addresses = copyCollection(c.getAddresses(), Address.class); onlineResources = copyCollection(c.getOnlineResources(), OnlineResource.class); contactType = c.getContactType(); } else { phones = singleton(object.getPhone(), Telephone.class); addresses = singleton(object.getAddress(), Address.class); onlineResources = singleton(object.getOnlineResource(), OnlineResource.class); } } }