/** * Util method to recheck attribute in module. * @param module module to check * @param attributeName name of attribute in module to find * @return true if attribute is present in module */ private boolean containsAttribute(Configuration module, String attributeName) { final String[] names = module.getAttributeNames(); final Optional<String> result = Arrays.stream(names) .filter(name -> name.equals(attributeName)).findFirst(); return result.isPresent(); }
/** * Implements the Configurable interface using bean introspection. * * <p>Subclasses are allowed to add behaviour. After the bean * based setup has completed first the method * {@link #finishLocalSetup finishLocalSetup} * is called to allow completion of the bean's local setup, * after that the method {@link #setupChild setupChild} * is called for each {@link Configuration#getChildren child Configuration} * of {@code configuration}. * * @see Configurable */ @Override public final void configure(Configuration config) throws CheckstyleException { configuration = config; final String[] attributes = config.getAttributeNames(); for (final String key : attributes) { final String value = config.getAttribute(key); tryCopyProperty(config.getName(), key, value, true); } finishLocalSetup(); final Configuration[] childConfigs = config.getChildren(); for (final Configuration childConfig : childConfigs) { setupChild(childConfig); } }
/** * Util method to recheck attribute in module. * @param module module to check * @param attributeName name of attribute in module to find * @return true if attribute is present in module */ private boolean containsAttribute(Configuration module, String attributeName) { final String[] names = module.getAttributeNames(); final Optional<String> result = Arrays.stream(names) .filter(name -> name.equals(attributeName)).findFirst(); return result.isPresent(); }
/** * Implements the Configurable interface using bean introspection. * * <p>Subclasses are allowed to add behaviour. After the bean * based setup has completed first the method * {@link #finishLocalSetup finishLocalSetup} * is called to allow completion of the bean's local setup, * after that the method {@link #setupChild setupChild} * is called for each {@link Configuration#getChildren child Configuration} * of {@code configuration}. * * @see Configurable */ @Override public final void configure(Configuration config) throws CheckstyleException { configuration = config; final String[] attributes = config.getAttributeNames(); for (final String key : attributes) { final String value = config.getAttribute(key); tryCopyProperty(config.getName(), key, value, true); } finishLocalSetup(); final Configuration[] childConfigs = config.getChildren(); for (final Configuration childConfig : childConfigs) { setupChild(childConfig); } }
List<String> attribnames = new ArrayList<>( Arrays.asList( checkerConfig.getAttributeNames() ) ); attribnames.remove( "severity" ); // special value (deserves unique column) if ( !attribnames.isEmpty() )