コード例 #1
0
 protected void verifyEvents(ComponentLibrary library) {
   for (EventModel event : library.getEvents()) {
     ClassName listenerInterface = event.getListenerInterface();
     SourceUtils sourceUtils = sourceUtilsProvider.get();
     if (null != listenerInterface) {
       event.setGenerateListener(!sourceUtils.isClassExists(listenerInterface));
     }
     String methodName = event.getListenerMethod();
     if (null == methodName) {
       methodName = "process";
       event.setListenerMethod(methodName);
     }
     ClassName sourceInterface = event.getSourceInterface();
     if (null != sourceInterface) {
       event.setGenerateSource(!sourceUtils.isClassExists(sourceInterface));
     }
     // Propagate event to corresponding components.
     for (ComponentModel component : library.getComponents()) {
       for (EventModel componentEvent : component.getEvents()) {
         if (event.getType().equals(componentEvent.getType())) {
           componentEvent.merge(event);
         }
       }
     }
   }
 }
コード例 #2
0
 private BeanProperty findBeanProperty(PropertyBase attribute, GeneratedFacesComponent component) {
   SourceUtils sourceUtils = sourceUtilsProvider.get();
   BeanProperty beanProperty =
       sourceUtils.getBeanProperty(component.getBaseClass(), attribute.getName());
   if (beanProperty instanceof DummyPropertyImpl && component instanceof ComponentModel) {
     ComponentModel model = (ComponentModel) component;
     if (null != model.getParent()) {
       beanProperty = findBeanProperty(attribute, model.getParent());
     }
   }
   if (beanProperty instanceof DummyPropertyImpl && component instanceof ModelElementBase) {
     ModelElementBase model = (ModelElementBase) component;
     for (ClassName interfaceName : model.getInterfaces()) {
       beanProperty = sourceUtils.getBeanProperty(interfaceName, attribute.getName());
       if (!(beanProperty instanceof DummyPropertyImpl)) {
         break;
       }
     }
   }
   return beanProperty;
 }