CompoundLabel { public final static boolean isCompound(String label) { if(label == null || label.isEmpty()) throw new IllegalArgumentException("Input label cannot be NULL or EMPTY"); if(label.length() > 1) return label.contains(SEPARATOR); else return false; } CompoundLabel(String type);  CompoundLabel(String type, String subType);  CompoundLabel(String type, String subType, String proto); final static boolean isCompound(String label); final static boolean isValidCompound(String label); final static String[] labelComponents(String label); CompoundLabel buildByLabel(String label); String getType(); String getSubType(); String getProto(); boolean hasSubType(); boolean hasProtocol(); String prefixString(); String prefixString(String protocol); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testIsCompound() { Assert.assertFalse(CompoundLabel.isCompound("coap")); Assert.assertTrue(CompoundLabel.isCompound("coap:")); Assert.assertTrue(CompoundLabel.isCompound("coap:tcp")); Assert.assertTrue(CompoundLabel.isCompound("coap:subcoap:udp")); try { Assert.assertFalse(CompoundLabel.isCompound(":")); } catch(Exception e) { } }