コード例 #1
0
 private void loadCustomTideComponents(XMap element, boolean custom) {
   for (XMap component : element.getAll("tide-components/tide-component")) {
     boolean disabled = Boolean.TRUE.toString().equals(component.get("@disabled"));
     String type = component.get("@type");
     if (type != null)
       tideComponentMatchers.add(TIDE_COMPONENT_MATCHER_FACTORY.getTypeMatcher(type, disabled));
     else {
       String name = component.get("@name");
       if (name != null)
         tideComponentMatchers.add(TIDE_COMPONENT_MATCHER_FACTORY.getNameMatcher(name, disabled));
       else {
         String instanceOf = component.get("@instance-of");
         if (instanceOf != null)
           tideComponentMatchers.add(
               TIDE_COMPONENT_MATCHER_FACTORY.getInstanceOfMatcher(instanceOf, disabled));
         else {
           String annotatedWith = component.get("@annotated-with");
           if (annotatedWith == null)
             throw new GraniteConfigException(
                 "Element 'component' has no attribute 'type', 'name', 'instance-of' or 'annotated-with'");
           tideComponentMatchers.add(
               TIDE_COMPONENT_MATCHER_FACTORY.getAnnotatedWithMatcher(annotatedWith, disabled));
         }
       }
     }
   }
 }
コード例 #2
0
 public boolean isComponentTideDisabled(
     String componentName, Set<Class<?>> componentClasses, Object instance) {
   return TideComponentMatcherFactory.isComponentTideDisabled(
       disabledTideComponentsByName,
       tideComponentMatchers,
       componentName,
       componentClasses,
       instance);
 }