/** * Returns a predicated (validating) map backed by the given map. * <p> * Only objects that pass the tests in the given predicates can be added to the map. * Trying to add an invalid object results in an IllegalArgumentException. * Keys must pass the key predicate, values must pass the value predicate. * It is important not to use the original map after invoking this method, * as it is a backdoor for adding invalid objects. * * @param map the map to predicate, must not be null * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) { return PredicatedMap.decorate(map, keyPred, valuePred); }
/** * Returns a predicated (validating) map backed by the given map. * <p> * Only objects that pass the tests in the given predicates can be added to the map. * Trying to add an invalid object results in an IllegalArgumentException. * Keys must pass the key predicate, values must pass the value predicate. * It is important not to use the original map after invoking this method, * as it is a backdoor for adding invalid objects. * * @param map the map to predicate, must not be null * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) { return PredicatedMap.decorate(map, keyPred, valuePred); }
protected Map decorateMap(Map map, Predicate keyPredicate, Predicate valuePredicate) { return PredicatedMap.decorate(map, keyPredicate, valuePredicate); }
/** * Returns a predicated (validating) map backed by the given map. * <p> * Only objects that pass the tests in the given predicates can be added to the map. * Trying to add an invalid object results in an IllegalArgumentException. * Keys must pass the key predicate, values must pass the value predicate. * It is important not to use the original map after invoking this method, * as it is a backdoor for adding invalid objects. * * @param map the map to predicate, must not be null * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) { return PredicatedMap.decorate(map, keyPred, valuePred); }
/** * Returns a predicated (validating) map backed by the given map. * <p> * Only objects that pass the tests in the given predicates can be added to the map. * Trying to add an invalid object results in an IllegalArgumentException. * Keys must pass the key predicate, values must pass the value predicate. * It is important not to use the original map after invoking this method, * as it is a backdoor for adding invalid objects. * * @param map the map to predicate, must not be null * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) { return PredicatedMap.decorate(map, keyPred, valuePred); }
/** * Returns a predicated (validating) map backed by the given map. * <p> * Only objects that pass the tests in the given predicates can be added to the map. * Trying to add an invalid object results in an IllegalArgumentException. * Keys must pass the key predicate, values must pass the value predicate. * It is important not to use the original map after invoking this method, * as it is a backdoor for adding invalid objects. * * @param map the map to predicate, must not be null * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) { return PredicatedMap.decorate(map, keyPred, valuePred); }
/** * Returns a predicated (validating) map backed by the given map. * <p> * Only objects that pass the tests in the given predicates can be added to the map. * Trying to add an invalid object results in an IllegalArgumentException. * Keys must pass the key predicate, values must pass the value predicate. * It is important not to use the original map after invoking this method, * as it is a backdoor for adding invalid objects. * * @param map the map to predicate, must not be null * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) { return PredicatedMap.decorate(map, keyPred, valuePred); }
/** * Returns a predicated (validating) map backed by the given map. * <p> * Only objects that pass the tests in the given predicates can be added to the map. * Trying to add an invalid object results in an IllegalArgumentException. * Keys must pass the key predicate, values must pass the value predicate. * It is important not to use the original map after invoking this method, * as it is a backdoor for adding invalid objects. * * @param map the map to predicate, must not be null * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) { return PredicatedMap.decorate(map, keyPred, valuePred); }
/** * Returns a predicated (validating) map backed by the given map. * <p> * Only objects that pass the tests in the given predicates can be added to the map. * Trying to add an invalid object results in an IllegalArgumentException. * Keys must pass the key predicate, values must pass the value predicate. * It is important not to use the original map after invoking this method, * as it is a backdoor for adding invalid objects. * * @param map the map to predicate, must not be null * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) { return PredicatedMap.decorate(map, keyPred, valuePred); }
/** * Returns a predicated (validating) map backed by the given map. * <p> * Only objects that pass the tests in the given predicates can be added to the map. * Trying to add an invalid object results in an IllegalArgumentException. * Keys must pass the key predicate, values must pass the value predicate. * It is important not to use the original map after invoking this method, * as it is a backdoor for adding invalid objects. * * @param map the map to predicate, must not be null * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map predicatedMap(Map map, Predicate keyPred, Predicate valuePred) { return PredicatedMap.decorate(map, keyPred, valuePred); }
private Map createParameterMap() { return PredicatedMap.decorate(new HashMap(), PRED_TYPE_OF_STRING, PRED_OR_STR_STRARR); } }
/** * Create a new ConfigurationException with the specified problem fields. * * @param problemFields Map of field names to error messages. * @param cause The cause of this exception. */ public ConfigurationException(Map problemFields, Throwable cause) { super(cause); problemFields = new HashMap(problemFields); problemFields = PredicatedMap.decorate(problemFields, PRED_STRING_TYPE, PRED_STRING_TYPE); this.problemFields = Collections.unmodifiableMap(problemFields); }
/** * Create a new ConfigurationException with a single problem field. * * @param fieldName The name of the problem field. * @param errorMessage The error message for that field. * @param cause The cause of this exception. */ public ConfigurationException(String fieldName, String errorMessage, Throwable cause) { super(cause); final Map problemFields = PredicatedMap.decorate(new HashMap(), PRED_STRING_TYPE, PRED_STRING_TYPE); problemFields.put(fieldName, errorMessage); this.problemFields = Collections.unmodifiableMap(problemFields); }
/** * @param actions The actions to set. */ public void setActions(Map actions) { if (actions == null) { throw new IllegalArgumentException("actions may not be null"); } //Defensive copy actions = new HashMap(actions); //Predicate for type safety actions = PredicatedMap.decorate(actions, PRED_STRING_TYPE, PRED_ACTION_TYPE); //Make unmodifiable this.actions = Collections.unmodifiableMap(actions); }
/** * @param pages The pages to set. */ public void setPages(Map pages) { if (pages == null) { throw new IllegalArgumentException("pages may not be null"); } if (pages.size() < 1) { throw new IllegalArgumentException("pages property must contain at least one entry"); } //Defensive copy pages = new HashMap(pages); //Predicate for type safety pages = PredicatedMap.decorate(pages, PRED_PAGE_NAME, PRED_IWIZARDPAGE_TYPE); //Make unmodifiable this.pages = Collections.unmodifiableMap(pages); }
/** * @param pages The pages to set. */ public void setPages(Map pages) { if (pages == null) { throw new IllegalArgumentException("pages may not be null"); } if (pages.size() < 1) { throw new IllegalArgumentException("pages property must contain at least one entry"); } //Defensive copy pages = new HashMap(pages); //Predicate for type safety pages = PredicatedMap.decorate(pages, PRED_STRING_TYPE, PRED_IACTIONPAGE_TYPE); //Make unmodifiable this.pages = Collections.unmodifiableMap(pages); }