/** * Creates a new instance of this class using the given parameters. * * @param configuration * The configuration for this component. * @param projectContext * The project context for this component. */ public ListCollectionFilter(final Configuration configuration, final IProjectContext projectContext) { super(configuration, projectContext); // Read the configuration this.maxNumberOfEntries = configuration.getIntProperty(CONFIG_PROPERTY_NAME_MAX_NUMBER_OF_ENTRIES); if (this.maxNumberOfEntries < 0) { this.unboundedList = true; } else { this.unboundedList = false; } final String strListFullBehavior = configuration.getStringProperty(CONFIG_PROPERTY_NAME_LIST_FULL_BEHAVIOR); ListFullBehavior tmpListFullBehavior; try { tmpListFullBehavior = ListFullBehavior.valueOf(strListFullBehavior); } catch (final IllegalArgumentException ex) { this.logger.warn("{} is no valid list full behavior! Using 'ignore' instead.", strListFullBehavior); tmpListFullBehavior = ListFullBehavior.ignore; } this.listFullBehavior = tmpListFullBehavior; this.list = new LinkedList<>(); }
/** * Creates a new instance of this class using the given parameters. * * @param configuration * The configuration for this component. * @param projectContext * The project context for this component. */ public ListCollectionFilter(final Configuration configuration, final IProjectContext projectContext) { super(configuration, projectContext); // Read the configuration this.maxNumberOfEntries = configuration.getIntProperty(CONFIG_PROPERTY_NAME_MAX_NUMBER_OF_ENTRIES); if (this.maxNumberOfEntries < 0) { this.unboundedList = true; } else { this.unboundedList = false; } final String strListFullBehavior = configuration.getStringProperty(CONFIG_PROPERTY_NAME_LIST_FULL_BEHAVIOR); ListFullBehavior tmpListFullBehavior; try { tmpListFullBehavior = ListFullBehavior.valueOf(strListFullBehavior); } catch (final IllegalArgumentException ex) { this.log.warn(strListFullBehavior + " is no valid list full behavior! Using 'ignore' instead."); tmpListFullBehavior = ListFullBehavior.ignore; } this.listFullBehavior = tmpListFullBehavior; this.list = new LinkedList<T>(); }
/** * {@inheritDoc} */ @Override public Configuration getCurrentConfiguration() { final Configuration configuration = new Configuration(); configuration.setProperty(CONFIG_PROPERTY_NAME_MAX_NUMBER_OF_ENTRIES, String.valueOf(this.maxNumberOfEntries)); configuration.setProperty(CONFIG_PROPERTY_NAME_LIST_FULL_BEHAVIOR, this.listFullBehavior.name()); return configuration; } }
/** * {@inheritDoc} */ @Override public Configuration getCurrentConfiguration() { final Configuration configuration = new Configuration(); configuration.setProperty(CONFIG_PROPERTY_NAME_MAX_NUMBER_OF_ENTRIES, String.valueOf(this.maxNumberOfEntries)); configuration.setProperty(CONFIG_PROPERTY_NAME_LIST_FULL_BEHAVIOR, this.listFullBehavior.name()); return configuration; } }