private List<String> getEventTypes(final IClass classNode) { final ArrayList<String> types = new ArrayList<String>(); for (final IMetaData data : classNode.getMetaData(MetaData.EVENT)) { final String[] name = data.getProperty("name"); final String eventName = name.length == 0 ? data.getDefaultValue() : name[0]; types.add(eventName); } return types; }
/* * (non-Javadoc) * @seecom.adobe.ac.pmd.rules.core.AbstractFlexMetaDataRule# * findViolationsFromClassMetaData(com.adobe.ac.pmd.nodes.IClass) */ @Override protected void findViolationsFromClassMetaData(final IClass classNode) { final List<IMetaData> managedEvents = ParsleyMetaData.MANAGED_EVENTS.getMetaDataList(classNode); final List<String> eventTypes = getEventTypes(classNode); for (final IMetaData data : managedEvents) { final List<String> types = data.getPropertyAsList("names"); for (final String type : types) { if (!eventTypes.contains(type)) { addViolation(data, type); } } } }