public static Person newInstance(Integer id, String name, Date birthDate) { Person person = new Person(); person.setId(id); person.setName(name); person.setBirthDate(birthDate); return person; }
public Hospital() { super(); // TODO Auto-generated constructor stub patient.setPatient("honey singh"); patient.setId(1); patient.setHealthStatus(HealthStatus.BAD); }
public static void main(String[] args) throws IOException { ObjectMapper mapper = new ObjectMapper(); Person value = new Person(); value.setBirthday("01.11.2013"); value.setId(1); value.setName("Mathew"); System.out.println(mapper.writeValueAsString(value)); }
public static void main(String[] args) { HibernateTemplate template = (HibernateTemplate) Util.getObject("template"); final Person p1 = new Person(); p1.setId(109); p1.setFirstName("vins"); p1.setLastName("jains"); p1.setAge(26); Object obj = template.save(p1); System.out.println("done with " + obj); System.out.println("done"); }
public static Person getObject() { Person person = new Person(); person.setNamespaces(new Namespace("tns", "http://www.pinae.com")); person.setNamespaces(new Namespace("tns2", "http://www.pinae.org")); person.setId(1); Person.Sex sex = person.new Sex(); sex.setValue("1"); Website website1 = new Website(); website1.setValue("http://www.google.com"); Website website2 = new Website(); website2.setValue("http://www.baidu.com"); Website website3 = new Website(); website3.setValue("http://www.163.com"); Website website4 = new Website(); website4.setValue("http://www.21cn.com"); person.setWebsite(website1); person.setWebsite(website2); person.setWebsite(website3); person.setWebsite(website4); Name name = new Name(); Name.Firstname firstname = name.new Firstname(); Name.Lastname lastname = name.new Lastname(); firstname.setValue("Tom"); lastname.setValue("Jim"); name.setFirstname(firstname); name.setLastname(lastname); Telephone telephone = new Telephone(); Telephone.Mobile mobile = telephone.new Mobile(); mobile.setNet("gsm"); mobile.setValue("13343351822"); Telephone.Office office = telephone.new Office(); office.setValue("010-8556697"); Telephone.Home home = telephone.new Home(); home.setValue("0757-82988679"); telephone.setHome(home); telephone.setOffice(office); telephone.setMobile(mobile); person.setBirthday(new Date()); person.setName(name); person.setAge(23); person.setSex(sex); person.setTelephone(telephone); person.setOther(new CdataText("<XML>Tearcher</XML>")); person.setPc("<Model>Acer 4750G</Model>"); return person; }
public static void main(String[] args) throws IOException { long start = System.currentTimeMillis(); Socket s = new Socket("localhost", 4444); ObjectOutputStream toServer = new ObjectOutputStream(s.getOutputStream()); Person p = new Person("John", 0); for (int id = 0; id < HowMany.times; id++) { p.setId(id); toServer.writeObject(p); toServer.reset(); } long end = System.currentTimeMillis(); System.out.println("Total time " + (end - start) / 1000 + "s"); }
private void prepareTestData() { r1 = newRoom(RoomType.apartment, 1); r2 = newRoom(RoomType.apartment, 2); r3 = newRoom(RoomType.bungalow, 3); p1 = newPerson("Jozko1", "Mrkvička1", "obc3211", "tel6541", "[email protected]"); p2 = newPerson("Jozko2", "Mrkvička2", "obc3212", "tel6542", "[email protected]"); p3 = newPerson("Jozko3", "Mrkvička3", "obc3213", "tel6543", "[email protected]"); p4 = newPerson("Jozko4", "Mrkvička4", "obc3214", "tel6544", "[email protected]"); p5 = newPerson("Jozko5", "Mrkvička5", "obc3215", "tel6545", "[email protected]"); personManager.createPerson(p1); personManager.createPerson(p2); personManager.createPerson(p3); personManager.createPerson(p4); personManager.createPerson(p5); roomManager.createRoom(r1); roomManager.createRoom(r2); roomManager.createRoom(r3); roomWithNullId = newRoom(RoomType.apartment, 1); roomNotInDB = newRoom(RoomType.apartment, 1); roomNotInDB.setId(r3.getId() + 100); personWithNullId = newPerson( "Jozko null", "Mrkvička null", "obc321 null", "tel654 null", "[email protected] null"); personNotInDB = newPerson( "Jozko not in db", "Mrkvička not in db", "obc321 not in db", "tel654 not in db", "[email protected] not in db"); personNotInDB.setId(p5.getId() + 100); }
@Test public void testMergeInts() throws Exception { c1.setId(42L); result = (Person) ObjectMerge.merge(c1, c1); assertEquals("Merge Integers", Long.valueOf(42), result.getId()); }