1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.model.internal.reference

File SymbolScheme.java

 

Code metrics

0
0
0
1
67
14
0
-
-
0
-

Classes

Class Line # Actions
SymbolScheme 36 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.model.internal.reference;
21   
22    import java.util.Map;
23   
24    import org.xwiki.component.annotation.Role;
25    import org.xwiki.model.EntityType;
26    import org.xwiki.stability.Unstable;
27   
28    /**
29    * The character symbols used to represent an {@link org.xwiki.model.reference.EntityReference} as a String.
30    *
31    * @version $Id: a1f38a9b18356ef55fbe20ce21be4140717fe585 $
32    * @since 8.1M2
33    */
34    @Unstable
35    @Role
 
36    public interface SymbolScheme
37    {
38    /**
39    * @return the character used for escaping characters in Entity Reference names
40    */
41    Character getEscapeSymbol();
42   
43    /**
44    * @return the map containing all the symbols to separate Entity Types. The map's key is an Entity Type and
45    * the value is another map who's key is the second Entity Type and its value is the character separating
46    * the 2 Entity Types. For example you could have the {@code .} character separating an
47    * {@link EntityType#DOCUMENT} and a {@link EntityType#SPACE}. Note that a given Entity Type can have
48    * several separator characters if it can have several different parent types (e.g. a Space reference can
49    * have either a Space Entity Type or a Wiki Entity Type)
50    */
51    Map<EntityType, Map<EntityType, Character>> getSeparatorSymbols();
52   
53    /**
54    * @param type the Entity Type for which to get the list of strings to escape. For example for a SPACE Entity type
55    * you could want to escape {@code .}, {@code :} and {@code \}.
56    * @return the various strings that require escaping for the passed Entity type
57    */
58    String[] getSymbolsRequiringEscapes(EntityType type);
59   
60    /**
61    * @param type the Entity Type for which to get the list of strings to use to replace each escape returned by
62    * {@link #getSymbolsRequiringEscapes(EntityType)}. For example for a SPACE Entity type you could
63    * want to replace {@code .} with {@code \.}, {@code :} with {@code \:} and {@code \} with {@code \\}
64    * @return the various replacement strings to replace string that require escaping
65    */
66    String[] getReplacementSymbols(EntityType type);
67    }