/** Initialize a reference with parsed element. * @param currentRef the reference * @param resElem the new element * @return ret&0x01 if content changed, ret&0x02 if attributes changed. */ private int initializeReference(FileObjRef currentRef, ResourceElem resElem) { if (!currentRef.isInitialized()) { currentRef.initialize(resElem); return 0x00; } else { boolean attrDiff = currentRef.attacheAttrs(resElem.getAttr(false)); currentRef.setUrlContext(resElem.getUrlContext()); boolean diff = false; if (resElem.getContent() != null) { diff = !(currentRef.content instanceof byte[]) || !java.util.Arrays.equals((byte[])currentRef.content, resElem.getContent()); currentRef.content = resElem.getContent(); } else if (resElem.getURI() != null) { diff = !resElem.getURI().equals(currentRef.content); currentRef.content = resElem.getURI(); } return (diff ? 0x01 : 0x00) + (attrDiff ? 0x02 : 0x00); } }
private void initializeReference (FileObjRef currentRef, ResourceElem resElem) { if (!currentRef.isInitialized ()) currentRef.initialize (resElem); else { currentRef.attacheAttrs (resElem.getAttr (false)); currentRef.setUrlContext (resElem.getUrlContext ()); if (resElem.getContent() != null) { currentRef.content = resElem.getContent(); } else if (resElem.getURI() != null) { currentRef.content = resElem.getURI(); } } }
private void initializeReference (FileObjRef currentRef, ResourceElem resElem) { if (!currentRef.isInitialized ()) currentRef.initialize (resElem); else { currentRef.attacheAttrs (resElem.getAttr (false)); currentRef.setUrlContext (resElem.getUrlContext ()); if (resElem.getContent() != null) { currentRef.content = resElem.getContent(); } else if (resElem.getURI() != null) { currentRef.content = resElem.getURI(); } } }