/** * Replace any parameters of the same type with the one specified. * @param parameter parameter to add to this list in place of all others with the same name * @return true if successfully added to this list */ public final boolean replace(final Parameter parameter) { for (final Iterator<Parameter> i = getParameters(parameter.getName()).iterator(); i.hasNext();) { remove(i.next()); } return add(parameter); }
protected static void replaceParameter(ParameterList parameterList, Parameter parameter) { if (parameter == null) { return; } Parameter existingParam = parameterList.getParameter(parameter.getName()); if (existingParam != null) { parameterList.remove(existingParam); } parameterList.add(parameter); }
/** * @param value */ private ImmutableClazz(final String value) { super(new ParameterList(true), value); }
/** * Replace any parameters of the same type with the one specified. * @param parameter parameter to add to this list in place of all others with the same name * @return true if successfully added to this list */ public final boolean replace(final Parameter parameter) { for (Parameter parameter1 : getParameters(parameter.getName())) { remove(parameter1); } return add(parameter); }
/** * Ensure a parameter doesn't occur in the specified list. * @param paramName the name of a parameter * @param parameters a list of parameters * @throws ValidationException thrown when the specified property * is found in the list of properties */ public void assertNone(final String paramName, final ParameterList parameters) throws ValidationException { if (parameters.getParameter(paramName) != null) { throw new ValidationException(ASSERT_NONE_MESSAGE, new Object[] {paramName}); } }
/** * Ensure a parameter occurs once. * * @param paramName * the parameter name * @param parameters * a list of parameters to query * @throws ValidationException * when the specified parameter does not occur once */ public void assertOne(final String paramName, final ParameterList parameters) throws ValidationException { if (parameters.getParameters(paramName).size() != 1) { throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {paramName}); } }
/** * @param dateTime The dateTime to set. */ public final void setDateTime(final DateTime dateTime) { super.setDateTime(dateTime); duration = null; getParameters().replace(Value.DATE_TIME); }
/** * Resets the timezone associated with the property. If utc is true, any TZID parameters are removed and the Java * timezone is updated to UTC time. If utc is false, TZID parameters are removed and the Java timezone is set to the * default timezone (i.e. represents a "floating" local time) * * @param utc the UTC value */ public final void setUtc(final boolean utc) { if (dates == null || !Value.DATE_TIME.equals(dates.getType())) { throw new UnsupportedOperationException( "TimeZone is not applicable to current value"); } dates.setUtc(utc); getParameters().remove(getParameter(Parameter.TZID)); }
/** * Remove all parameters with the specified name. * @param paramName the name of parameters to remove */ public final void removeAll(final String paramName) { final ParameterList params = getParameters(paramName); parameters.removeAll(params.parameters); }
/** * @param p * @return AbbreviatedValue */ public static AbbreviatedValue getAbbrevVal(final Property p) { ParameterList pars = p.getParameters(); ParameterList abbrevPars = pars.getParameters(Parameter.ABBREV); Collection<String> abbrevs = new ArrayList<String>(); Iterator it = abbrevPars.iterator(); while (it.hasNext()) { Parameter par = (Parameter)it.next(); abbrevs.add(par.getValue()); } return new AbbreviatedValue(abbrevs, p.getValue()); }
/** * Replace any parameters of the same type with the one specified. * @param parameter parameter to add to this list in place of all others with the same name * @return true if successfully added to this list */ public final boolean replace(final Parameter parameter) { for (Parameter parameter1 : getParameters(parameter.getName())) { remove(parameter1); } return add(parameter); }
/** * Ensure a parameter doesn't occur in the specified list. * @param paramName the name of a parameter * @param parameters a list of parameters * @throws ValidationException thrown when the specified property * is found in the list of properties */ public void assertNone(final String paramName, final ParameterList parameters) throws ValidationException { if (parameters.getParameter(paramName) != null) { throw new ValidationException(ASSERT_NONE_MESSAGE, new Object[] {paramName}); } }
/** * Ensure a parameter occurs no more than once. * * @param paramName * the parameter name * @param parameters * a list of parameters to query * @throws ValidationException * when the specified parameter occurs more than once */ public void assertOneOrLess(final String paramName, final ParameterList parameters) throws ValidationException { if (parameters.getParameters(paramName).size() > 1) { throw new ValidationException(ASSERT_ONE_OR_LESS_MESSAGE, new Object[] {paramName}); } }
/** * @param dateTime The dateTime to set. */ public final void setDateTime(final DateTime dateTime) { super.setDateTime(dateTime); duration = null; getParameters().replace(Value.DATE_TIME); }
private void fixDateTimeProperties(Component component) { PropertyList<Property> props = component.getProperties(); for(Property prop : props) { if(prop instanceof DateProperty || prop instanceof DateListProperty) { Value v = (Value) prop.getParameter(Parameter.VALUE); if(Value.DATE_TIME.equals(v)) { prop.getParameters().remove(v); } } } }
/** * Remove all parameters with the specified name. * @param paramName the name of parameters to remove */ public final void removeAll(final String paramName) { final ParameterList params = getParameters(paramName); parameters.removeAll(params.parameters); }
/** * Replace any parameters of the same type with the one specified. * @param parameter parameter to add to this list in place of all others with the same name * @return true if successfully added to this list */ public final boolean replace(final Parameter parameter) { for (final Iterator i = getParameters(parameter.getName()).iterator(); i.hasNext();) { remove((Parameter) i.next()); } return add(parameter); }