/** * Sets the variable suffix to use. * <p> * The variable suffix is the character or characters that identify the * end of a variable. This method allows a single character suffix to * be easily set. * * @param suffix the suffix character to use * @return this, to enable chaining */ public StrSubstitutor setVariableSuffix(final char suffix) { return setVariableSuffixMatcher(StrMatcher.charMatcher(suffix)); }
/** * Sets the variable suffix to use. * <p> * The variable suffix is the character or characters that identify the * end of a variable. This method allows a string suffix to be easily set. * * @param suffix the suffix for variables, not null * @return this, to enable chaining * @throws IllegalArgumentException if the suffix is null */ public StrSubstitutor setVariableSuffix(final String suffix) { if (suffix == null) { throw new IllegalArgumentException("Variable suffix must not be null!"); } return setVariableSuffixMatcher(StrMatcher.stringMatcher(suffix)); }
/** * Creates a new instance and initializes it. * * @param variableResolver the variable resolver, may be null * @param prefixMatcher the prefix for variables, not null * @param suffixMatcher the suffix for variables, not null * @param escape the escape character * @param valueDelimiterMatcher the variable default value delimiter matcher, may be null * @throws IllegalArgumentException if the prefix or suffix is null * @since 3.2 */ public StrSubstitutor( final StrLookup<?> variableResolver, final StrMatcher prefixMatcher, final StrMatcher suffixMatcher, final char escape, final StrMatcher valueDelimiterMatcher) { this.setVariableResolver(variableResolver); this.setVariablePrefixMatcher(prefixMatcher); this.setVariableSuffixMatcher(suffixMatcher); this.setEscapeChar(escape); this.setValueDelimiterMatcher(valueDelimiterMatcher); }
/** * Tests get set. */ @Test public void testGetSetSuffix() { final StrSubstitutor sub = new StrSubstitutor(); assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher); sub.setVariableSuffix('<'); assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.CharMatcher); sub.setVariableSuffix("<<"); assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher); try { sub.setVariableSuffix(null); fail(); } catch (final IllegalArgumentException ex) { // expected } assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher); final StrMatcher matcher = StrMatcher.commaMatcher(); sub.setVariableSuffixMatcher(matcher); assertSame(matcher, sub.getVariableSuffixMatcher()); try { sub.setVariableSuffixMatcher(null); fail(); } catch (final IllegalArgumentException ex) { // expected } assertSame(matcher, sub.getVariableSuffixMatcher()); }
/** * Sets the variable suffix to use. * <p> * The variable suffix is the character or characters that identify the * end of a variable. This method allows a single character suffix to * be easily set. * * @param suffix the suffix character to use * @return this, to enable chaining */ public StrSubstitutor setVariableSuffix(final char suffix) { return setVariableSuffixMatcher(StrMatcher.charMatcher(suffix)); }
/** * Sets the variable suffix to use. * <p> * The variable suffix is the character or characters that identify the * end of a variable. This method allows a single character suffix to * be easily set. * * @param suffix the suffix character to use * @return this, to enable chaining */ public StrSubstitutor setVariableSuffix(final char suffix) { return setVariableSuffixMatcher(StrMatcher.charMatcher(suffix)); }
/** * Sets the variable suffix to use. * <p> * The variable suffix is the character or characters that identify the * end of a variable. This method allows a single character suffix to * be easily set. * * @param suffix the suffix character to use * @return this, to enable chaining */ public StrSubstitutor setVariableSuffix(final char suffix) { return setVariableSuffixMatcher(StrMatcher.charMatcher(suffix)); }
/** * Sets the variable suffix to use. * <p> * The variable suffix is the character or characters that identify the * end of a variable. This method allows a string suffix to be easily set. * * @param suffix the suffix for variables, not null * @return this, to enable chaining * @throws IllegalArgumentException if the suffix is null */ public StrSubstitutor setVariableSuffix(final String suffix) { if (suffix == null) { throw new IllegalArgumentException("Variable suffix must not be null!"); } return setVariableSuffixMatcher(StrMatcher.stringMatcher(suffix)); }
/** * Sets the variable suffix to use. * <p> * The variable suffix is the character or characters that identify the * end of a variable. This method allows a string suffix to be easily set. * * @param suffix the suffix for variables, not null * @return this, to enable chaining * @throws IllegalArgumentException if the suffix is null */ public StrSubstitutor setVariableSuffix(final String suffix) { if (suffix == null) { throw new IllegalArgumentException("Variable suffix must not be null!"); } return setVariableSuffixMatcher(StrMatcher.stringMatcher(suffix)); }
/** * Sets the variable suffix to use. * <p> * The variable suffix is the character or characters that identify the * end of a variable. This method allows a string suffix to be easily set. * * @param suffix the suffix for variables, not null * @return this, to enable chaining * @throws IllegalArgumentException if the suffix is null */ public StrSubstitutor setVariableSuffix(final String suffix) { if (suffix == null) { throw new IllegalArgumentException("Variable suffix must not be null!"); } return setVariableSuffixMatcher(StrMatcher.stringMatcher(suffix)); }
/** * Creates a new instance and initializes it. * * @param variableResolver the variable resolver, may be null * @param prefixMatcher the prefix for variables, not null * @param suffixMatcher the suffix for variables, not null * @param escape the escape character * @param valueDelimiterMatcher the variable default value delimiter matcher, may be null * @throws IllegalArgumentException if the prefix or suffix is null * @since 3.2 */ public StrSubstitutor( final StrLookup<?> variableResolver, final StrMatcher prefixMatcher, final StrMatcher suffixMatcher, final char escape, final StrMatcher valueDelimiterMatcher) { this.setVariableResolver(variableResolver); this.setVariablePrefixMatcher(prefixMatcher); this.setVariableSuffixMatcher(suffixMatcher); this.setEscapeChar(escape); this.setValueDelimiterMatcher(valueDelimiterMatcher); }
/** * Creates a new instance and initializes it. * * @param variableResolver the variable resolver, may be null * @param prefixMatcher the prefix for variables, not null * @param suffixMatcher the suffix for variables, not null * @param escape the escape character * @param valueDelimiterMatcher the variable default value delimiter matcher, may be null * @throws IllegalArgumentException if the prefix or suffix is null * @since 3.2 */ public StrSubstitutor( final StrLookup<?> variableResolver, final StrMatcher prefixMatcher, final StrMatcher suffixMatcher, final char escape, final StrMatcher valueDelimiterMatcher) { this.setVariableResolver(variableResolver); this.setVariablePrefixMatcher(prefixMatcher); this.setVariableSuffixMatcher(suffixMatcher); this.setEscapeChar(escape); this.setValueDelimiterMatcher(valueDelimiterMatcher); }
/** * Creates a new instance and initializes it. * * @param variableResolver the variable resolver, may be null * @param prefixMatcher the prefix for variables, not null * @param suffixMatcher the suffix for variables, not null * @param escape the escape character * @param valueDelimiterMatcher the variable default value delimiter matcher, may be null * @throws IllegalArgumentException if the prefix or suffix is null * @since 3.2 */ public StrSubstitutor( final StrLookup<?> variableResolver, final StrMatcher prefixMatcher, final StrMatcher suffixMatcher, final char escape, final StrMatcher valueDelimiterMatcher) { this.setVariableResolver(variableResolver); this.setVariablePrefixMatcher(prefixMatcher); this.setVariableSuffixMatcher(suffixMatcher); this.setEscapeChar(escape); this.setValueDelimiterMatcher(valueDelimiterMatcher); }