2 * Copyright 2000-2018 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.v7.data.util.sqlcontainer.query.generator.filter;
18 import java.io.Serializable;
21 * The StringDecorator knows how to produce a quoted string using the specified
22 * quote start and quote end characters. It also handles grouping of a string
23 * (surrounding it in parenthesis).
25 * Extend this class if you need to support special characters for grouping
30 * @deprecated As of 8.0, no replacement available.
33 public class StringDecorator implements Serializable {
35 private final String quoteStart;
36 private final String quoteEnd;
39 * Constructs a StringDecorator that uses the quoteStart and quoteEnd
40 * characters to create quoted strings.
43 * the character denoting the start of a quote.
45 * the character denoting the end of a quote.
47 public StringDecorator(String quoteStart, String quoteEnd) {
48 this.quoteStart = quoteStart;
49 this.quoteEnd = quoteEnd;
53 * Surround a string with quote characters.
57 * @return the quoted string
59 public String quote(Object str) {
60 return quoteStart + str + quoteEnd;
64 * Groups a string by surrounding it in parenthesis.
68 * @return the grouped string
70 public String group(String str) {
71 return "(" + str + ")";