Переливаем из пустого в порожнее забавно.

    Date: 04/11/07 (Code WTF)    Keywords: no keywords

    diamondPlaceEntity.setPlace(extractPlace(mainNode, diamondPlaceEntity.getPlace()));
    
    	private PlaceEntity extractPlace(Node mainNode, PlaceEntity ent) throws Exception {
    
    		NodeList properties = mainNode.getChildNodes();
    		for (int i = 0; i < properties.getLength(); i++) {
    			Node node = properties.item(i);
    			String nodeId = node.getAttributes().getNamedItem("id").getNodeValue();
    			String value = node.getTextContent();
    
    			if (nodeId.equals("geoUnitId")) {
    				ent.setGeoUnitId(NumberUtils.toLong(value));
    			} else if (nodeId.equals("geoUnitTitle")) {
    				ent.setGeoUnitName(value);
    			} else if (nodeId.equals("about")) {
    				ent.setFieldAbout(value);
    			} else if (nodeId.equals("startDate")) {
    				ent.setStartDate(core.Utils.parseDate(value));
    			} else if (nodeId.equals("stopDate")) {
    				ent.setStopDate(core.Utils.parseDate(value));
    			}
    
    		}
    		return ent;
    	}
    

    Source: http://community.livejournal.com/code_wtf/80150.html

« Новый подход к... || Высоты ООП »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home