@Test public void testGetProperty() { Map<String, Object> p = new HashMap<>(); p.put(RemoteConstants.ENDPOINT_ID, "http: p.put("notAString", new Object()); p.put(org.osgi.framework.Constants.OBJECTCLASS, new String[]{"my.class"}); p.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[]{"my.config"}); EndpointDescription endpoint = new EndpointDescription(p); assertNull(PropertyHelper.getProperty(endpoint.getProperties(), "unknownProp")); assertEquals(p.get(RemoteConstants.ENDPOINT_ID), PropertyHelper.getProperty(endpoint.getProperties(), RemoteConstants.ENDPOINT_ID)); assertNull(PropertyHelper.getProperty(endpoint.getProperties(), "notAString")); }
public static String getProperty(Map<String, Object> dict, String name) { Object value = dict.get(name); return value instanceof String ? (String) value : null; }
PropertyHelper { public static String getProperty(Map<String, Object> dict, String name) { Object value = dict.get(name); return value instanceof String ? (String) value : null; } }
PropertyHelper { public static String getProperty(Map<String, Object> dict, String name) { Object value = dict.get(name); return value instanceof String ? (String) value : null; } private  PropertyHelper(); }
PropertyHelper { public static String getProperty(Map<String, Object> dict, String name) { Object value = dict.get(name); return value instanceof String ? (String) value : null; } private  PropertyHelper(); @SuppressWarnings("unchecked") static Collection<String> getMultiValueProperty(Object property); static String getProperty(Map<String, Object> dict, String name); static String getFirstNonEmptyStringProperty(Map<String, Object> dict, String... keys); }
PropertyHelper { public static String getProperty(Map<String, Object> dict, String name) { Object value = dict.get(name); return value instanceof String ? (String) value : null; } private  PropertyHelper(); @SuppressWarnings("unchecked") static Collection<String> getMultiValueProperty(Object property); static String getProperty(Map<String, Object> dict, String name); static String getFirstNonEmptyStringProperty(Map<String, Object> dict, String... keys); static final Logger LOG; }