void initialize() {} void initData(Customer customer) { customerName.setText(customer.getName());
Intent intent=getIntent(); Customer cust=(Customer)intent.getSerializableExtra("bundle"); textViewName.setText(cust.getName()); textViewCity.setText(cust.getCity());
private void getCustomer() { list = new CustomerDAO().getCustomer(); if(!list.isEmpty()){ for(Customer c : list){ Object addItem = table.addItem(); table.getItem(addItem).getItemProperty("Customer").setValue(c.getName()); } } }
List<Customer> list = yourFunction(); List<String> names = Arrays.asList(map(list.toArray(new Customer[0]), new MapFunction<Customer, String>() { public String map(Customer c) { return c.getName(); } }));
String targetName = "Jane"; List<Customer> list = new ArrayList<Customer>(); Iterator<Customer> iter = list.iterator(); while (iter.hasNext()) { Customer c = iter.next(); if (targetName.equals(c.getName())) { iter.remove(); break; } }
@RolesAllowed("ROLE_ADMIN") @Override public void updateCustomer(Customer customer) { String userName = SecurityContextHolder.getContext().getAuthentication().getName(); System.out.println("Customer " + customer.getName() + " updated by user " + userName); }
JAXBContext jc = JAXBContext.newInstance(Customer.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); Customer customer = (Customer) unmarshaller.unmarshal(reader); System.out.println(customer.getName()); for (Element el : customer.getExtras()) { System.out.println(el.getNodeName() + "->" + el.getTextContent());
EntityManager entityManager = Persistence.createEntityManagerFactory("CustomerLibraryPU").createEntityManager(); Query query = entityManager.createQuery("SELECT c FROM Customer c"); List<Customer> resultList = query.getResultList(); for (Customer c : resultList) { jTextArea1.append(c.getName() + " (" + c.getCity() + ")" + "\n"); }
Customer customer = ...; // get the customer from some place try { // some code here customer.createInvoice(); // more code here } catch (CustomerNotEnrolledException e) { // handle CustomerNotEnrolledException here, maybe show error message? System.out.println("Exception creating invoice for customer " + customer.getName() + ": " + e.getMessage()); }
Function<Customer, String> customerToName = new Function<Customer, String>() { public String apply(Customer c) { return c.getName(); }; List<String> allCustomerNamesList = Lists.transform(list, customerToName);
//insert with named parameter public void insertNamedParameter(Customer customer){ String sql = "INSERT INTO CUSTOMER " + "(CUST_ID, NAME, AGE) VALUES (:custId, :name, :age)"; Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("custId", customer.getCustId()); parameters.put("name", customer.getName()); parameters.put("age", customer.getAge()); getSimpleJdbcTemplate().update(sql, parameters); }
public void insertCustomerListToB(ArrayList<Customer> customerList) { for (Customer customer : customerList) { ContentValues cv = new ContentValues(); cv.put(DB_TABLE.CUSTOMER_CODE, customer.getCode()); cv.put(DB_TABLE.CUSTOMER_NAME, customer.getName()); cv.put(DB_TABLE.CUSTOMER_ADDRESS, customer.getAddress()); dbB.insert(DB_TABLE.CUSTOMER, null, cv); } }
@RequestMapping(value = "/customer", method = RequestMethod.POST) public String addCustomer(@ModelAttribute("customer") Customer customer,Model model) { service.addCustomer(customer); model.addAttribute("custid",customer.getCustId()); model.addAttribute("name", customer.getName()); model.addAttribute("age", customer.getAge()); return "customer/customer"; }
private void printCustomer( final Customer c ) { try { System.out.println( "Customer " + c.getSurname() + " " + c.getName() + "living in " + c.getAddress().getCity() + ", " + c.getAddress().getStreet() ); } catch ( NullPointerException ex ) { System.err.println( "Unable to print out customer information.", ex ); }
for (int i = 0; i < MainActivity.customers.size(); i++) { Customer customer = MainActivity.customers.get(i); if (customer.getLon() != 0.0) { if (!customer.isProspect()) { Data mData= new Data(customer.getLat(),customer.getLon(),customer.getName(), customer.getOrt()); LatLng location = new LatLng(mData.lat, mData.lng); Marker marker = mMap.addMarker(new MarkerOptions().position(location) .title(mData.title) .snippet(mData.snippet)); mMarkerArray.add(marker); }}}
User user = new User(); // Using the same one over and over, won't work List<Customer> customers = fetchCustomersFromSomeService(); for(Customer customer : customers) { // User user = new User(); <-- This would work, you get a new one each time user.setId(customer.getId()); user.setName(customer.getName()); saveUserToDB(user); }