@Test public void testSerialize() throws GDException, JSONException { context.checking(new Expectations() { { } }); String json = device.serialize(Format.JSON); System.out.println(json); context.assertIsSatisfied(); try { JSONObject jsonObject = new JSONObject(json); System.out.println(jsonObject); } catch (JSONException e) { fail(e.getMessage()); } }
@Override public String serialize(Format format) throws GDException { checkPermission(GenericDevice.class, Type.GET); try { return SerializationUtil.execute(format, mapper -> mapper.writerWithView(View.ID.Ignore.class).writeValueAsString(this)); } catch (SerializationException ex) { throw new GDException(ex.getMessage(), ex); } }
GenericDeviceImpl extends GenericDevice.Stub implements GenericDevice { @Override public String serialize(Format format) throws GDException { checkPermission(GenericDevice.class, Type.GET); try { return SerializationUtil.execute(format, mapper -> mapper.writerWithView(View.ID.Ignore.class).writeValueAsString(this)); } catch (SerializationException ex) { throw new GDException(ex.getMessage(), ex); } } }
GenericDeviceImpl extends GenericDevice.Stub implements GenericDevice { @Override public String serialize(Format format) throws GDException { checkPermission(GenericDevice.class, Type.GET); try { return SerializationUtil.execute(format, mapper -> mapper.writerWithView(View.ID.Ignore.class).writeValueAsString(this)); } catch (SerializationException ex) { throw new GDException(ex.getMessage(), ex); } } protected  GenericDeviceImpl(); }
GenericDeviceImpl extends GenericDevice.Stub implements GenericDevice { @Override public String serialize(Format format) throws GDException { checkPermission(GenericDevice.class, Type.GET); try { return SerializationUtil.execute(format, mapper -> mapper.writerWithView(View.ID.Ignore.class).writeValueAsString(this)); } catch (SerializationException ex) { throw new GDException(ex.getMessage(), ex); } } protected  GenericDeviceImpl(); static Map<String, Object> getDeviceProperties(com.ericsson.deviceaccess.api.GenericDevice dev); @Override GDService getService(String name); GDServiceImpl getServiceImpl(String svcName); @Override Map<String, GDService> getServices(); @Override void putService(GDService svc); @Override void setId(String id); @Override String getId(); @Override String getURN(); @Override void setURN(String urn); @Override void setName(String name); @Override String getName(); @Override void setType(String type); @Override String getType(); @Override void setProtocol(String protocol); @Override String getProtocol(); @Override void setLocation(String location); @Override String getLocation(); @Override void setOnline(boolean online); @Override boolean isOnline(); @Override void setIcon(String icon); @Override String getIcon(); @Override State getState(); void setState(State state); @Override String getPath(boolean isAbsolute); @Override String getPath(); @Override void updatePath(String path); @Override void setContact(String contact); @Override String getContact(); void setService(Map service); @Override void setManufacturer(String manufacturer); @Override String getManufacturer(); @Override void setModelName(String modelName); @Override String getModelName(); @Override void setDescription(String description); @Override String getDescription(); @Override void setSerialNumber(String serialNumber); @Override String getSerialNumber(); @Override void setProductClass(String productClass); @Override String getProductClass(); @Override String serialize(Format format); @Override String serializeState(); @Override String getSerializedNode(String path, Format format); @JsonIgnore Map<String, Object> getDeviceProperties(); void notifyEvent(String serviceId, final Map<String, Object> parameters); void notifyEventRemoved(String serviceId, String propertyId); void notifyEventAdded(String serviceId, String propertyId); }
GenericDeviceImpl extends GenericDevice.Stub implements GenericDevice { @Override public String serialize(Format format) throws GDException { checkPermission(GenericDevice.class, Type.GET); try { return SerializationUtil.execute(format, mapper -> mapper.writerWithView(View.ID.Ignore.class).writeValueAsString(this)); } catch (SerializationException ex) { throw new GDException(ex.getMessage(), ex); } } protected  GenericDeviceImpl(); static Map<String, Object> getDeviceProperties(com.ericsson.deviceaccess.api.GenericDevice dev); @Override GDService getService(String name); GDServiceImpl getServiceImpl(String svcName); @Override Map<String, GDService> getServices(); @Override void putService(GDService svc); @Override void setId(String id); @Override String getId(); @Override String getURN(); @Override void setURN(String urn); @Override void setName(String name); @Override String getName(); @Override void setType(String type); @Override String getType(); @Override void setProtocol(String protocol); @Override String getProtocol(); @Override void setLocation(String location); @Override String getLocation(); @Override void setOnline(boolean online); @Override boolean isOnline(); @Override void setIcon(String icon); @Override String getIcon(); @Override State getState(); void setState(State state); @Override String getPath(boolean isAbsolute); @Override String getPath(); @Override void updatePath(String path); @Override void setContact(String contact); @Override String getContact(); void setService(Map service); @Override void setManufacturer(String manufacturer); @Override String getManufacturer(); @Override void setModelName(String modelName); @Override String getModelName(); @Override void setDescription(String description); @Override String getDescription(); @Override void setSerialNumber(String serialNumber); @Override String getSerialNumber(); @Override void setProductClass(String productClass); @Override String getProductClass(); @Override String serialize(Format format); @Override String serializeState(); @Override String getSerializedNode(String path, Format format); @JsonIgnore Map<String, Object> getDeviceProperties(); void notifyEvent(String serviceId, final Map<String, Object> parameters); void notifyEventRemoved(String serviceId, String propertyId); void notifyEventAdded(String serviceId, String propertyId);  }