Example #1
0
 /**
  * This method virifies type/family attributes for JSF objects ( components, renderers,
  * validators, converters, behaviors )
  *
  * @param component object to verify.
  * @param callback callback to corresponding naming conventions.
  * @return
  */
 protected boolean verifyTypes(
     GeneratedFacesComponent component, NamingConventionsCallback callback) {
   // Check JsfComponent type.
   try {
     if (null == component.getId()) {
       if (null != component.getTargetClass()) {
         component.setId(callback.inferType(component.getTargetClass()));
       } else if (null != component.getBaseClass()) {
         component.setId(callback.inferType(component.getBaseClass()));
       } else {
         component.setId(callback.inferType());
       }
     }
     // Check classes.
     if (null == component.getGenerate()) {
       if (null == component.getTargetClass()) {
         component.setTargetClass(callback.inferClass(component.getId()));
       }
       component.setGenerate(!sourceUtilsProvider.get().isClassExists(component.getTargetClass()));
     }
     if (component.getGenerate()) {
       verifyGeneratedClasses(component, callback);
     } else if (null == component.getTargetClass()) {
       if (null == component.getBaseClass()) {
         component.setBaseClass(callback.getDefaultClass());
       }
       component.setTargetClass(component.getBaseClass());
     }
   } catch (CallbackException e) {
     log.error(e.getMessage());
     return false;
   }
   return true;
 }
Example #2
0
 private void verifyGeneratedClasses(
     GeneratedFacesComponent component, NamingConventionsCallback callback)
     throws CallbackException {
   if (null == component.getBaseClass()) {
     component.setBaseClass(callback.getDefaultBaseClass());
     // return;
   }
   if (null == component.getTargetClass()) {
     component.setTargetClass(callback.inferClass(component.getId()));
   }
 }