Address a = new Address(); a.phone="001-555-12345";
private static List<Address> getClusterAddresses(RaftJournalConfiguration conf) { return conf.getClusterAddresses().stream() .map(addr -> new Address(addr.getHostName(), addr.getPort())) .collect(Collectors.toList()); }
Person p = new Person() {{ setFirstName("John"); setLastName("Doe"); setAddress(new Address() {{ setStreet("1234 St."); setCity("Phoenix"); }}); }};
private static Address getLocalAddress(RaftJournalConfiguration conf) { return new Address(conf.getLocalAddress().getHostName(), conf.getLocalAddress().getPort()); }
JSONObject result = results.getJSONObject(i); String indiStr = result.getString("formatted_address"); Address addr = new Address(Locale.getDefault()); addr.setAddressLine(0, indiStr); retList.add(addr);
int port = socket.getLocalPort(); CopycatServer server = CopycatServer .builder(new Address(NetworkAddressUtils.getConnectHost(ServiceType.MASTER_RAFT, ServerConfiguration.global()), port)) server.join(RaftJournalConfiguration.defaults(serviceType) .getClusterAddresses().stream() .map(addr -> new Address(addr.getHostName(), addr.getPort())) .collect(Collectors.toList())); while (lastUpdate.get() < 0
public class Tester { public static void main(String [] args) throws Exception { // Make a service AddressBookService service = new AddressBookServiceLocator(); // Now use the service to get a stub which implements the SDI. AddressBook port = service.getAddressBook(); // Make the actual call Address address = new Address(...); port.addEntry("Russell Butek", address); } }
import java.util.*; import javax.xml.bind.*; import org.eclipse.persistence.jaxb.JAXBContextProperties; import org.eclipse.persistence.sessions.SessionEventListener; public class Demo { public static void main(String[] args) throws Exception { Map<String, Object> properties = new HashMap<String, Object>(1); SessionEventListener sessionEventListener = new NullPolicySessionEventListener(); properties.put(JAXBContextProperties.SESSION_EVENT_LISTENER, sessionEventListener); JAXBContext jc = JAXBContext.newInstance(new Class[] {Address.class}, properties); Address address = new Address(); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(address, System.out); } }
import javax.xml.bind.*; import javax.xml.stream.*; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Customer.class); Address address = new Address("123 A Street"); Customer customer = new Customer("Jane", address); XMLOutputFactory xof = XMLOutputFactory.newFactory(); XMLStreamWriter xsw = xof.createXMLStreamWriter(System.out); Marshaller marshaller = jc.createMarshaller(); marshaller.setListener(new MyMarshallerListener(xsw)); marshaller.marshal(customer, xsw); xsw.close();; } }
/** * Returns a new Copycat server builder using the default host:port. * <p> * The server will be constructed at 0.0.0.0:8700. * * @return The server builder. */ public static Builder builder() { return builder(new Address(DEFAULT_HOST, DEFAULT_PORT)); }
Address someAddress = new Address(); someAddress.setCity(aCity); someAddress.setState(aState); Bank bank = new Bank(); bank.setBankAddress(someAddress); ... public void setBankAddress(Address aBankAddress) { bankAddress = aBankAddress; }
Address address1 = new Address("07093", "Brooklyn", "129 67th st", null, "USA"); Address address2 = new Address("03333", "Qeeens", "333 67th st", null, "USA"); address1 = addressRepository.save(address1); address2 = addressRepository.save(address2); // save a couple of customers Customer jack = new Customer("Jack", "Bauer"); jack.setHomeAddress(address1); repository.save(jack); repository.save(new Customer("Chloe", "O'Brian",address1));
@Rule public ExpectedException exception = ExpectedException.none(); @Test public void testToString() throws IllegalCustomerIDException { System.out.println("toString"); exception.expect(IllegalCustomerIDException.class); exception.expectMessage("unkwon customer id 4711"); Address add = new Address("Blackthorn","Kings Lynn","PE30"); BusinessOrganisationDetails instance = new BusinessOrganisationDetails("PEA-1234", "Smith",add,10,"EA",12); }
/** * Creates a collection of member addresses. */ private List<Member> createMembers(int nodes) { List<Member> members = new ArrayList<>(); for (int i = 0; i < nodes; i++) { members.add(new ServerMember(Member.Type.ACTIVE, new Address("localhost", 5000 + i), new Address("localhost", 6000 + i), Instant.now())); } return members; }
/** * Tests member getters. */ public void testMemberGetters() { Instant instant = Instant.now(); ServerMember member = new ServerMember(Member.Type.ACTIVE, new Address("localhost", 5000), new Address("localhost", 6000), instant); assertEquals(member.type(), Member.Type.ACTIVE); assertEquals(member.status(), ServerMember.Status.AVAILABLE); assertEquals(member.serverAddress(), new Address("localhost", 5000)); assertEquals(member.clientAddress(), new Address("localhost", 6000)); assertEquals(member.updated(), instant); }
Address addressData = new Address(); addressData.setContact_id(contact_id); addressData.setCity(city); addressData.setStreet(street); addressData.setZipCode(zipCode); HashMap<String,Address> map = new HashMap<String, Address>(); map.put("data", addressData); long newId = datasource.createAddress(map);
/** * Tests serializing and deserializing a member. */ public void testSerializeDeserialize() { Instant instant = Instant.now(); ServerMember member = new ServerMember(Member.Type.ACTIVE, new Address("localhost", 5000), null, instant); Serializer serializer = new Serializer().resolve(new ProtocolSerialization(), new ServerSerialization(), new StorageSerialization()); ServerMember result = serializer.readObject(serializer.writeObject(member).flip()); assertEquals(result.type(), member.type()); assertEquals(result.updated(), member.updated()); }