/** * @param ical * @param name * @return null or first matching component */ public static BaseComponentType findComponent(final IcalendarType ical, final QName name) { for (VcalendarType v: ical.getVcalendar()) { if (name.equals(XcalTags.vcalendar)) { return v; } BaseComponentType bc = findComponent(v, name); if (bc != null) { return bc; } } return null; }
/** * @param bcPar * @param name * @return null or first matching component */ public static BaseComponentType findComponent(final BaseComponentType bcPar, final QName name) { List<JAXBElement<? extends BaseComponentType>> cs = getComponents(bcPar); if (cs == null) { return null; } for (JAXBElement<? extends BaseComponentType> bcel: cs) { if (bcel.getName().equals(name)) { return bcel.getValue(); } BaseComponentType bc = findComponent(bcel.getValue(), name); if (bc != null) { return bc; } } return null; }