@Test public void interfaces() throws Exception { ServiceReference reference = mock(ServiceReference.class); ServiceModel model = new ServiceModel(reference); when(reference.getProperty(Constants.OBJECTCLASS)).thenReturn(new String[]{List.class.getName()}); assertThat(model.getInterfaces()).isEqualTo(List.class.getName()); when(reference.getProperty(Constants.OBJECTCLASS)).thenReturn(new String[]{List.class.getName(), String.class.getName()}); assertThat(model.getInterfaces()).isEqualTo(List.class.getName() + ", " + String.class.getName()); }
public String getInterfaces() { String[] specs = (String[]) this.reference.getProperty(Constants.OBJECTCLASS); if (specs == null) { return null; } StringBuilder builder = new StringBuilder(); for (String spec : specs) { if (builder.length() == 0) { builder.append(spec); } else { builder.append(", ").append(spec); } } return builder.toString(); }
ServiceModel { public String getInterfaces() { String[] specs = (String[]) this.reference.getProperty(Constants.OBJECTCLASS); if (specs == null) { return null; } StringBuilder builder = new StringBuilder(); for (String spec : specs) { if (builder.length() == 0) { builder.append(spec); } else { builder.append(", ").append(spec); } } return builder.toString(); } }
ServiceModel { public String getInterfaces() { String[] specs = (String[]) this.reference.getProperty(Constants.OBJECTCLASS); if (specs == null) { return null; } StringBuilder builder = new StringBuilder(); for (String spec : specs) { if (builder.length() == 0) { builder.append(spec); } else { builder.append(", ").append(spec); } } return builder.toString(); } ServiceModel(ServiceReference reference); }
ServiceModel { public String getInterfaces() { String[] specs = (String[]) this.reference.getProperty(Constants.OBJECTCLASS); if (specs == null) { return null; } StringBuilder builder = new StringBuilder(); for (String spec : specs) { if (builder.length() == 0) { builder.append(spec); } else { builder.append(", ").append(spec); } } return builder.toString(); } ServiceModel(ServiceReference reference); static List<ServiceModel> services(BundleContext context); String getInterfaces(); long getId(); String getProvidingBundle(); Map<String, String> getProperties(); }
ServiceModel { public String getInterfaces() { String[] specs = (String[]) this.reference.getProperty(Constants.OBJECTCLASS); if (specs == null) { return null; } StringBuilder builder = new StringBuilder(); for (String spec : specs) { if (builder.length() == 0) { builder.append(spec); } else { builder.append(", ").append(spec); } } return builder.toString(); } ServiceModel(ServiceReference reference); static List<ServiceModel> services(BundleContext context); String getInterfaces(); long getId(); String getProvidingBundle(); Map<String, String> getProperties();  }