Java Code Examples for org.fourthline.cling.model.meta.Icon#deepCopy()
The following examples show how to use
org.fourthline.cling.model.meta.Icon#deepCopy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RetrieveRemoteDescriptors.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
protected RemoteDevice describeServices(RemoteDevice currentDevice) throws RouterException, DescriptorBindingException, ValidationException { List<RemoteService> describedServices = new ArrayList(); if (currentDevice.hasServices()) { List<RemoteService> filteredServices = filterExclusiveServices(currentDevice.getServices()); for (RemoteService service : filteredServices) { RemoteService svc = describeService(service); if (svc == null) { // Something went wrong, bail out return null; } describedServices.add(svc); } } List<RemoteDevice> describedEmbeddedDevices = new ArrayList(); if (currentDevice.hasEmbeddedDevices()) { for (RemoteDevice embeddedDevice : currentDevice.getEmbeddedDevices()) { if (embeddedDevice == null) continue; RemoteDevice describedEmbeddedDevice = describeServices(embeddedDevice); if (describedEmbeddedDevice == null) { // Something was wrong, recursively return null; } describedEmbeddedDevices.add(describedEmbeddedDevice); } } Icon[] iconDupes = new Icon[currentDevice.getIcons().length]; for (int i = 0; i < currentDevice.getIcons().length; i++) { Icon icon = currentDevice.getIcons()[i]; iconDupes[i] = icon.deepCopy(); } // Yes, we create a completely new immutable graph here return currentDevice.newInstance( currentDevice.getIdentity().getUdn(), currentDevice.getVersion(), currentDevice.getType(), currentDevice.getDetails(), iconDupes, currentDevice.toServiceArray(describedServices), describedEmbeddedDevices ); }
Example 2
Source File: RetrieveRemoteDescriptors.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected RemoteDevice describeServices(RemoteDevice currentDevice) throws RouterException, DescriptorBindingException, ValidationException { List<RemoteService> describedServices = new ArrayList(); if (currentDevice.hasServices()) { List<RemoteService> filteredServices = filterExclusiveServices(currentDevice.getServices()); for (RemoteService service : filteredServices) { RemoteService svc = describeService(service); if (svc == null) { // Something went wrong, bail out return null; } describedServices.add(svc); } } List<RemoteDevice> describedEmbeddedDevices = new ArrayList(); if (currentDevice.hasEmbeddedDevices()) { for (RemoteDevice embeddedDevice : currentDevice.getEmbeddedDevices()) { if (embeddedDevice == null) continue; RemoteDevice describedEmbeddedDevice = describeServices(embeddedDevice); if (describedEmbeddedDevice == null) { // Something was wrong, recursively return null; } describedEmbeddedDevices.add(describedEmbeddedDevice); } } Icon[] iconDupes = new Icon[currentDevice.getIcons().length]; for (int i = 0; i < currentDevice.getIcons().length; i++) { Icon icon = currentDevice.getIcons()[i]; iconDupes[i] = icon.deepCopy(); } // Yes, we create a completely new immutable graph here return currentDevice.newInstance( currentDevice.getIdentity().getUdn(), currentDevice.getVersion(), currentDevice.getType(), currentDevice.getDetails(), iconDupes, currentDevice.toServiceArray(describedServices), describedEmbeddedDevices ); }