View Javadoc

1   /*
2    * Copyright 2004-2005 Dan Washusen
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.reactive.beans.factory.config;
18  
19  /***
20   * Used to determine if the provided value is indeed a placeholder for a configurable value.
21   *
22   * @author Dan Washusen
23   * @version $Id: PlaceholderMatcher.java,v 1.2 2004/12/29 11:59:31 dan_washusen Exp $
24   * @since 16.12.2004
25   * @see DefaultPlaceholderMatcher
26   */
27  public interface PlaceholderMatcher {
28      /***
29       * (Re-)Initialise the matcher for a new value.
30       * @param value The value that we are now matching
31       */
32      void init(String value);
33  
34      /***
35       * A method to dermine if the provided key is a placeholder for a configurable value.
36       * @return true if the key needs to be evaluated, otherwise false
37       */
38      boolean isPlaceholderPresent();
39  
40      /***
41       * A method to determine if the provided value contains multiple placeholders.
42       * @return true if multiple placeholders are present, otherwise false
43       */
44      boolean isMultiplePlaceholdersPresent();
45  
46      /***
47       * Returns the next placeholder to be evaluated.
48       * <p>Note: much like the iterator class, the {@link #hasNext()} method must be called
49       * before this method.</p>
50       * @return The next {@link Placeholder}.
51       */
52      Placeholder next();
53  
54      /***
55       * Moves to the next placeholder if one is available and returns true, otherwise this method returns false
56       * @return true if another placeholder is available, otherwise false
57       */
58      boolean hasNext();
59  
60      /***
61       * Returns the proceeding text of the current {@link Placeholder}.
62       * <p>e.g. a value of "some proceeding text ${placeholder}" would return "some proceeding next "
63       * after the first call to {@link #hasNext()}.</p>
64       * @return The text proceeding the current placeholder, or null if no proceeding text is available
65       */
66      String getProceedingText();
67  
68      /***
69       * Returns the trailing text of the current {@link Placeholder}.
70       * <p>e.g. a value of "some proceeding text ${placeholder} some trailing text" would return " some trailing text"
71       * after the first call to {@link #hasNext()}.</p>
72       * <p>Note: the trailing text is also the proceeding text of the next placehodler where there are more placeholders.</p>
73       * @return The text proceeding the current placeholder, or null if no proceeding text is available
74       */
75      String getTrailingText();
76  }