/** return true if this has an associated list object. */ public static boolean hasList(SIPHeader sipHeader) { if (sipHeader instanceof SIPHeaderList) return false; else { Class<?> headerClass = sipHeader.getClass(); return headerListTable.get(headerClass) != null; } }
/** Return a list object for this header if it has an associated list object. */ @SuppressWarnings("unchecked") public static SIPHeaderList<SIPHeader> getList(SIPHeader sipHeader) { if (!initialized) initializeListMap(); try { Class<?> headerClass = sipHeader.getClass(); Class<?> listClass = headerListTable.get(headerClass); SIPHeaderList<SIPHeader> shl = (SIPHeaderList<SIPHeader>) listClass.newInstance(); shl.setHeaderName(sipHeader.getName()); return shl; } catch (InstantiationException ex) { ex.printStackTrace(); } catch (IllegalAccessException ex) { ex.printStackTrace(); } return null; }