View Javadoc
1   /**
2    * Copyright (C) 2014-2017 Philip Helger (www.helger.com)
3    * philip[at]helger[dot]com
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    *         http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package com.helger.schematron.pure.binding.xpath;
18  
19  import java.io.Serializable;
20  
21  import javax.annotation.Nonnull;
22  import javax.annotation.Nullable;
23  
24  import com.helger.commons.annotation.ReturnsMutableCopy;
25  import com.helger.commons.collection.ext.ICommonsNavigableMap;
26  import com.helger.commons.lang.ICloneable;
27  
28  /**
29   * Read-only interface for {@link PSXPathVariables}.
30   *
31   * @author Philip Helger
32   */
33  public interface IPSXPathVariables extends ICloneable <PSXPathVariables>, Serializable
34  {
35    /**
36     * Perform the text replacement of all variables in the specified text.
37     *
38     * @param sText
39     *        The source text. May be <code>null</code>.
40     * @return The text with all values replaced. May be <code>null</code> if the
41     *         source text is <code>null</code>.
42     */
43    @Nullable
44    String getAppliedReplacement (@Nullable String sText);
45  
46    /**
47     * @return All contained variable key value pairs. Never <code>null</code>.
48     */
49    @Nonnull
50    @ReturnsMutableCopy
51    ICommonsNavigableMap <String, String> getAll ();
52  
53    /**
54     * @param sName
55     *        Name of the variable to check
56     * @return <code>true</code> if a variable with the passed name in present.
57     */
58    boolean contains (@Nullable String sName);
59  
60    /**
61     * @param sName
62     *        Variable name
63     * @return The variable value of the variable with the specified name or
64     *         <code>null</code> if no such variable is present.
65     */
66    @Nullable
67    String get (@Nullable String sName);
68  }