commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject svn commit: r1008161 [9/44] - in /websites/production/commons/content/proper/commons-text: ./ apidocs/ apidocs/org/apache/commons/text/ apidocs/org/apache/commons/text/class-use/ apidocs/org/apache/commons/text/diff/ apidocs/org/apache/commons/text/dif...
Date Sun, 12 Mar 2017 02:08:05 GMT
Modified: websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/StrLookup.html
==============================================================================
--- websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/StrLookup.html
(original)
+++ websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/StrLookup.html
Sun Mar 12 02:08:01 2017
@@ -39,153 +39,154 @@
 <span class="sourceLineNo">031</span> * For example, it would be possible to
implement a lookup that used the<a name="line.31"></a>
 <span class="sourceLineNo">032</span> * key as a primary key, and looked up the
value on demand from the database<a name="line.32"></a>
 <span class="sourceLineNo">033</span> *<a name="line.33"></a>
-<span class="sourceLineNo">034</span> * @since 1.0<a name="line.34"></a>
-<span class="sourceLineNo">035</span> */<a name="line.35"></a>
-<span class="sourceLineNo">036</span>public abstract class StrLookup&lt;V&gt;
{<a name="line.36"></a>
-<span class="sourceLineNo">037</span><a name="line.37"></a>
-<span class="sourceLineNo">038</span>    /**<a name="line.38"></a>
-<span class="sourceLineNo">039</span>     * Lookup that always returns null.<a
name="line.39"></a>
-<span class="sourceLineNo">040</span>     */<a name="line.40"></a>
-<span class="sourceLineNo">041</span>    private static final StrLookup&lt;String&gt;
NONE_LOOKUP = new MapStrLookup&lt;&gt;(null);<a name="line.41"></a>
-<span class="sourceLineNo">042</span><a name="line.42"></a>
-<span class="sourceLineNo">043</span>    /**<a name="line.43"></a>
-<span class="sourceLineNo">044</span>     * Lookup based on system properties.<a
name="line.44"></a>
-<span class="sourceLineNo">045</span>     */<a name="line.45"></a>
-<span class="sourceLineNo">046</span>    private static final StrLookup&lt;String&gt;
SYSTEM_PROPERTIES_LOOKUP = new SystemPropertiesStrLookup();<a name="line.46"></a>
-<span class="sourceLineNo">047</span><a name="line.47"></a>
-<span class="sourceLineNo">048</span>    //-----------------------------------------------------------------------<a
name="line.48"></a>
-<span class="sourceLineNo">049</span>    /**<a name="line.49"></a>
-<span class="sourceLineNo">050</span>     * Returns a lookup which always returns
null.<a name="line.50"></a>
-<span class="sourceLineNo">051</span>     *<a name="line.51"></a>
-<span class="sourceLineNo">052</span>     * @return a lookup that always returns
null, not null<a name="line.52"></a>
-<span class="sourceLineNo">053</span>     */<a name="line.53"></a>
-<span class="sourceLineNo">054</span>    public static StrLookup&lt;?&gt;
noneLookup() {<a name="line.54"></a>
-<span class="sourceLineNo">055</span>        return NONE_LOOKUP;<a name="line.55"></a>
-<span class="sourceLineNo">056</span>    }<a name="line.56"></a>
-<span class="sourceLineNo">057</span><a name="line.57"></a>
-<span class="sourceLineNo">058</span>    /**<a name="line.58"></a>
-<span class="sourceLineNo">059</span>     * Returns a new lookup which uses a
copy of the current<a name="line.59"></a>
-<span class="sourceLineNo">060</span>     * {@link System#getProperties() System
properties}.<a name="line.60"></a>
-<span class="sourceLineNo">061</span>     * &lt;p&gt;<a name="line.61"></a>
-<span class="sourceLineNo">062</span>     * If a security manager blocked access
to system properties, then null will<a name="line.62"></a>
-<span class="sourceLineNo">063</span>     * be returned from every lookup.<a
name="line.63"></a>
-<span class="sourceLineNo">064</span>     * &lt;p&gt;<a name="line.64"></a>
-<span class="sourceLineNo">065</span>     * If a null key is used, this lookup
will throw a NullPointerException.<a name="line.65"></a>
-<span class="sourceLineNo">066</span>     *<a name="line.66"></a>
-<span class="sourceLineNo">067</span>     * @return a lookup using system properties,
not null<a name="line.67"></a>
-<span class="sourceLineNo">068</span>     */<a name="line.68"></a>
-<span class="sourceLineNo">069</span>    public static StrLookup&lt;String&gt;
systemPropertiesLookup() {<a name="line.69"></a>
-<span class="sourceLineNo">070</span>        return SYSTEM_PROPERTIES_LOOKUP;<a
name="line.70"></a>
-<span class="sourceLineNo">071</span>    }<a name="line.71"></a>
-<span class="sourceLineNo">072</span><a name="line.72"></a>
-<span class="sourceLineNo">073</span>    /**<a name="line.73"></a>
-<span class="sourceLineNo">074</span>     * Returns a lookup which looks up values
using a map.<a name="line.74"></a>
-<span class="sourceLineNo">075</span>     * &lt;p&gt;<a name="line.75"></a>
-<span class="sourceLineNo">076</span>     * If the map is null, then null will
be returned from every lookup.<a name="line.76"></a>
-<span class="sourceLineNo">077</span>     * The map result object is converted
to a string using toString().<a name="line.77"></a>
-<span class="sourceLineNo">078</span>     *<a name="line.78"></a>
-<span class="sourceLineNo">079</span>     * @param &lt;V&gt; the type
of the values supported by the lookup<a name="line.79"></a>
-<span class="sourceLineNo">080</span>     * @param map  the map of keys to values,
may be null<a name="line.80"></a>
-<span class="sourceLineNo">081</span>     * @return a lookup using the map, not
null<a name="line.81"></a>
-<span class="sourceLineNo">082</span>     */<a name="line.82"></a>
-<span class="sourceLineNo">083</span>    public static &lt;V&gt; StrLookup&lt;V&gt;
mapLookup(final Map&lt;String, V&gt; map) {<a name="line.83"></a>
-<span class="sourceLineNo">084</span>        return new MapStrLookup&lt;&gt;(map);<a
name="line.84"></a>
-<span class="sourceLineNo">085</span>    }<a name="line.85"></a>
-<span class="sourceLineNo">086</span><a name="line.86"></a>
-<span class="sourceLineNo">087</span>    //-----------------------------------------------------------------------<a
name="line.87"></a>
-<span class="sourceLineNo">088</span>    /**<a name="line.88"></a>
-<span class="sourceLineNo">089</span>     * Constructor.<a name="line.89"></a>
-<span class="sourceLineNo">090</span>     */<a name="line.90"></a>
-<span class="sourceLineNo">091</span>    protected StrLookup() {<a name="line.91"></a>
-<span class="sourceLineNo">092</span>        super();<a name="line.92"></a>
-<span class="sourceLineNo">093</span>    }<a name="line.93"></a>
-<span class="sourceLineNo">094</span><a name="line.94"></a>
-<span class="sourceLineNo">095</span>    /**<a name="line.95"></a>
-<span class="sourceLineNo">096</span>     * Looks up a String key to a String
value.<a name="line.96"></a>
-<span class="sourceLineNo">097</span>     * &lt;p&gt;<a name="line.97"></a>
-<span class="sourceLineNo">098</span>     * The internal implementation may use
any mechanism to return the value.<a name="line.98"></a>
-<span class="sourceLineNo">099</span>     * The simplest implementation is to
use a Map. However, virtually any<a name="line.99"></a>
-<span class="sourceLineNo">100</span>     * implementation is possible.<a
name="line.100"></a>
-<span class="sourceLineNo">101</span>     * &lt;p&gt;<a name="line.101"></a>
-<span class="sourceLineNo">102</span>     * For example, it would be possible
to implement a lookup that used the<a name="line.102"></a>
-<span class="sourceLineNo">103</span>     * key as a primary key, and looked
up the value on demand from the database<a name="line.103"></a>
-<span class="sourceLineNo">104</span>     * Or, a numeric based implementation
could be created that treats the key<a name="line.104"></a>
-<span class="sourceLineNo">105</span>     * as an integer, increments the value
and return the result as a string -<a name="line.105"></a>
-<span class="sourceLineNo">106</span>     * converting 1 to 2, 15 to 16 etc.<a
name="line.106"></a>
-<span class="sourceLineNo">107</span>     * &lt;p&gt;<a name="line.107"></a>
-<span class="sourceLineNo">108</span>     * The {@link #lookup(String)} method
always returns a String, regardless of<a name="line.108"></a>
-<span class="sourceLineNo">109</span>     * the underlying data, by converting
it as necessary. For example:<a name="line.109"></a>
-<span class="sourceLineNo">110</span>     * &lt;pre&gt;<a name="line.110"></a>
-<span class="sourceLineNo">111</span>     * Map&amp;lt;String, Object&amp;gt;
map = new HashMap&amp;lt;String, Object&amp;gt;();<a name="line.111"></a>
-<span class="sourceLineNo">112</span>     * map.put("number", Integer.valueOf(2));<a
name="line.112"></a>
-<span class="sourceLineNo">113</span>     * assertEquals("2", StrLookup.mapLookup(map).lookup("number"));<a
name="line.113"></a>
-<span class="sourceLineNo">114</span>     * &lt;/pre&gt;<a name="line.114"></a>
-<span class="sourceLineNo">115</span>     * @param key  the key to be looked
up, may be null<a name="line.115"></a>
-<span class="sourceLineNo">116</span>     * @return the matching value, null
if no match<a name="line.116"></a>
-<span class="sourceLineNo">117</span>     */<a name="line.117"></a>
-<span class="sourceLineNo">118</span>    public abstract String lookup(String
key);<a name="line.118"></a>
-<span class="sourceLineNo">119</span><a name="line.119"></a>
-<span class="sourceLineNo">120</span>    //-----------------------------------------------------------------------<a
name="line.120"></a>
-<span class="sourceLineNo">121</span>    /**<a name="line.121"></a>
-<span class="sourceLineNo">122</span>     * Lookup implementation that uses a
Map.<a name="line.122"></a>
-<span class="sourceLineNo">123</span>     */<a name="line.123"></a>
-<span class="sourceLineNo">124</span>    static class MapStrLookup&lt;V&gt;
extends StrLookup&lt;V&gt; {<a name="line.124"></a>
-<span class="sourceLineNo">125</span><a name="line.125"></a>
-<span class="sourceLineNo">126</span>        /** Map keys are variable names
and value. */<a name="line.126"></a>
-<span class="sourceLineNo">127</span>        private final Map&lt;String,
V&gt; map;<a name="line.127"></a>
-<span class="sourceLineNo">128</span><a name="line.128"></a>
-<span class="sourceLineNo">129</span>        /**<a name="line.129"></a>
-<span class="sourceLineNo">130</span>         * Creates a new instance backed
by a Map.<a name="line.130"></a>
-<span class="sourceLineNo">131</span>         *<a name="line.131"></a>
-<span class="sourceLineNo">132</span>         * @param map  the map of keys to
values, may be null<a name="line.132"></a>
-<span class="sourceLineNo">133</span>         */<a name="line.133"></a>
-<span class="sourceLineNo">134</span>        MapStrLookup(final Map&lt;String,
V&gt; map) {<a name="line.134"></a>
-<span class="sourceLineNo">135</span>            this.map = map;<a name="line.135"></a>
-<span class="sourceLineNo">136</span>        }<a name="line.136"></a>
-<span class="sourceLineNo">137</span><a name="line.137"></a>
-<span class="sourceLineNo">138</span>        /**<a name="line.138"></a>
-<span class="sourceLineNo">139</span>         * Looks up a String key to a String
value using the map.<a name="line.139"></a>
-<span class="sourceLineNo">140</span>         * &lt;p&gt;<a name="line.140"></a>
-<span class="sourceLineNo">141</span>         * If the map is null, then null
is returned.<a name="line.141"></a>
-<span class="sourceLineNo">142</span>         * The map result object is converted
to a string using toString().<a name="line.142"></a>
-<span class="sourceLineNo">143</span>         *<a name="line.143"></a>
-<span class="sourceLineNo">144</span>         * @param key  the key to be looked
up, may be null<a name="line.144"></a>
-<span class="sourceLineNo">145</span>         * @return the matching value, null
if no match<a name="line.145"></a>
-<span class="sourceLineNo">146</span>         */<a name="line.146"></a>
-<span class="sourceLineNo">147</span>        @Override<a name="line.147"></a>
-<span class="sourceLineNo">148</span>        public String lookup(final String
key) {<a name="line.148"></a>
-<span class="sourceLineNo">149</span>            if (map == null) {<a name="line.149"></a>
-<span class="sourceLineNo">150</span>                return null;<a name="line.150"></a>
-<span class="sourceLineNo">151</span>            }<a name="line.151"></a>
-<span class="sourceLineNo">152</span>            final Object obj = map.get(key);<a
name="line.152"></a>
-<span class="sourceLineNo">153</span>            if (obj == null) {<a name="line.153"></a>
-<span class="sourceLineNo">154</span>                return null;<a name="line.154"></a>
-<span class="sourceLineNo">155</span>            }<a name="line.155"></a>
-<span class="sourceLineNo">156</span>            return obj.toString();<a
name="line.156"></a>
-<span class="sourceLineNo">157</span>        }<a name="line.157"></a>
-<span class="sourceLineNo">158</span>    }<a name="line.158"></a>
-<span class="sourceLineNo">159</span><a name="line.159"></a>
-<span class="sourceLineNo">160</span>    //-----------------------------------------------------------------------<a
name="line.160"></a>
-<span class="sourceLineNo">161</span>    /**<a name="line.161"></a>
-<span class="sourceLineNo">162</span>     * Lookup implementation based on system
properties.<a name="line.162"></a>
-<span class="sourceLineNo">163</span>     */<a name="line.163"></a>
-<span class="sourceLineNo">164</span>    private static class SystemPropertiesStrLookup
extends StrLookup&lt;String&gt; {<a name="line.164"></a>
-<span class="sourceLineNo">165</span>        /**<a name="line.165"></a>
-<span class="sourceLineNo">166</span>         * {@inheritDoc} This implementation
directly accesses system properties.<a name="line.166"></a>
-<span class="sourceLineNo">167</span>         */<a name="line.167"></a>
-<span class="sourceLineNo">168</span>        @Override<a name="line.168"></a>
-<span class="sourceLineNo">169</span>        public String lookup(final String
key) {<a name="line.169"></a>
-<span class="sourceLineNo">170</span>            if (key.length() &gt; 0)
{<a name="line.170"></a>
-<span class="sourceLineNo">171</span>                try {<a name="line.171"></a>
-<span class="sourceLineNo">172</span>                    return System.getProperty(key);<a
name="line.172"></a>
-<span class="sourceLineNo">173</span>                } catch (final SecurityException
scex) {<a name="line.173"></a>
-<span class="sourceLineNo">174</span>                    // Squelched. All lookup(String)
will return null.<a name="line.174"></a>
-<span class="sourceLineNo">175</span>                }<a name="line.175"></a>
-<span class="sourceLineNo">176</span>            }<a name="line.176"></a>
-<span class="sourceLineNo">177</span>            return null;<a name="line.177"></a>
-<span class="sourceLineNo">178</span>        }<a name="line.178"></a>
-<span class="sourceLineNo">179</span>    }<a name="line.179"></a>
-<span class="sourceLineNo">180</span>}<a name="line.180"></a>
+<span class="sourceLineNo">034</span> * @param &lt;V&gt; the type of
the values supported by the lookup<a name="line.34"></a>
+<span class="sourceLineNo">035</span> * @since 1.0<a name="line.35"></a>
+<span class="sourceLineNo">036</span> */<a name="line.36"></a>
+<span class="sourceLineNo">037</span>public abstract class StrLookup&lt;V&gt;
{<a name="line.37"></a>
+<span class="sourceLineNo">038</span><a name="line.38"></a>
+<span class="sourceLineNo">039</span>    /**<a name="line.39"></a>
+<span class="sourceLineNo">040</span>     * Lookup that always returns null.<a
name="line.40"></a>
+<span class="sourceLineNo">041</span>     */<a name="line.41"></a>
+<span class="sourceLineNo">042</span>    private static final StrLookup&lt;String&gt;
NONE_LOOKUP = new MapStrLookup&lt;&gt;(null);<a name="line.42"></a>
+<span class="sourceLineNo">043</span><a name="line.43"></a>
+<span class="sourceLineNo">044</span>    /**<a name="line.44"></a>
+<span class="sourceLineNo">045</span>     * Lookup based on system properties.<a
name="line.45"></a>
+<span class="sourceLineNo">046</span>     */<a name="line.46"></a>
+<span class="sourceLineNo">047</span>    private static final StrLookup&lt;String&gt;
SYSTEM_PROPERTIES_LOOKUP = new SystemPropertiesStrLookup();<a name="line.47"></a>
+<span class="sourceLineNo">048</span><a name="line.48"></a>
+<span class="sourceLineNo">049</span>    //-----------------------------------------------------------------------<a
name="line.49"></a>
+<span class="sourceLineNo">050</span>    /**<a name="line.50"></a>
+<span class="sourceLineNo">051</span>     * Returns a lookup which always returns
null.<a name="line.51"></a>
+<span class="sourceLineNo">052</span>     *<a name="line.52"></a>
+<span class="sourceLineNo">053</span>     * @return a lookup that always returns
null, not null<a name="line.53"></a>
+<span class="sourceLineNo">054</span>     */<a name="line.54"></a>
+<span class="sourceLineNo">055</span>    public static StrLookup&lt;?&gt;
noneLookup() {<a name="line.55"></a>
+<span class="sourceLineNo">056</span>        return NONE_LOOKUP;<a name="line.56"></a>
+<span class="sourceLineNo">057</span>    }<a name="line.57"></a>
+<span class="sourceLineNo">058</span><a name="line.58"></a>
+<span class="sourceLineNo">059</span>    /**<a name="line.59"></a>
+<span class="sourceLineNo">060</span>     * Returns a new lookup which uses a
copy of the current<a name="line.60"></a>
+<span class="sourceLineNo">061</span>     * {@link System#getProperties() System
properties}.<a name="line.61"></a>
+<span class="sourceLineNo">062</span>     * &lt;p&gt;<a name="line.62"></a>
+<span class="sourceLineNo">063</span>     * If a security manager blocked access
to system properties, then null will<a name="line.63"></a>
+<span class="sourceLineNo">064</span>     * be returned from every lookup.<a
name="line.64"></a>
+<span class="sourceLineNo">065</span>     * &lt;p&gt;<a name="line.65"></a>
+<span class="sourceLineNo">066</span>     * If a null key is used, this lookup
will throw a NullPointerException.<a name="line.66"></a>
+<span class="sourceLineNo">067</span>     *<a name="line.67"></a>
+<span class="sourceLineNo">068</span>     * @return a lookup using system properties,
not null<a name="line.68"></a>
+<span class="sourceLineNo">069</span>     */<a name="line.69"></a>
+<span class="sourceLineNo">070</span>    public static StrLookup&lt;String&gt;
systemPropertiesLookup() {<a name="line.70"></a>
+<span class="sourceLineNo">071</span>        return SYSTEM_PROPERTIES_LOOKUP;<a
name="line.71"></a>
+<span class="sourceLineNo">072</span>    }<a name="line.72"></a>
+<span class="sourceLineNo">073</span><a name="line.73"></a>
+<span class="sourceLineNo">074</span>    /**<a name="line.74"></a>
+<span class="sourceLineNo">075</span>     * Returns a lookup which looks up values
using a map.<a name="line.75"></a>
+<span class="sourceLineNo">076</span>     * &lt;p&gt;<a name="line.76"></a>
+<span class="sourceLineNo">077</span>     * If the map is null, then null will
be returned from every lookup.<a name="line.77"></a>
+<span class="sourceLineNo">078</span>     * The map result object is converted
to a string using toString().<a name="line.78"></a>
+<span class="sourceLineNo">079</span>     *<a name="line.79"></a>
+<span class="sourceLineNo">080</span>     * @param &lt;V&gt; the type
of the values supported by the lookup<a name="line.80"></a>
+<span class="sourceLineNo">081</span>     * @param map  the map of keys to values,
may be null<a name="line.81"></a>
+<span class="sourceLineNo">082</span>     * @return a lookup using the map, not
null<a name="line.82"></a>
+<span class="sourceLineNo">083</span>     */<a name="line.83"></a>
+<span class="sourceLineNo">084</span>    public static &lt;V&gt; StrLookup&lt;V&gt;
mapLookup(final Map&lt;String, V&gt; map) {<a name="line.84"></a>
+<span class="sourceLineNo">085</span>        return new MapStrLookup&lt;&gt;(map);<a
name="line.85"></a>
+<span class="sourceLineNo">086</span>    }<a name="line.86"></a>
+<span class="sourceLineNo">087</span><a name="line.87"></a>
+<span class="sourceLineNo">088</span>    //-----------------------------------------------------------------------<a
name="line.88"></a>
+<span class="sourceLineNo">089</span>    /**<a name="line.89"></a>
+<span class="sourceLineNo">090</span>     * Constructor.<a name="line.90"></a>
+<span class="sourceLineNo">091</span>     */<a name="line.91"></a>
+<span class="sourceLineNo">092</span>    protected StrLookup() {<a name="line.92"></a>
+<span class="sourceLineNo">093</span>        super();<a name="line.93"></a>
+<span class="sourceLineNo">094</span>    }<a name="line.94"></a>
+<span class="sourceLineNo">095</span><a name="line.95"></a>
+<span class="sourceLineNo">096</span>    /**<a name="line.96"></a>
+<span class="sourceLineNo">097</span>     * Looks up a String key to a String
value.<a name="line.97"></a>
+<span class="sourceLineNo">098</span>     * &lt;p&gt;<a name="line.98"></a>
+<span class="sourceLineNo">099</span>     * The internal implementation may use
any mechanism to return the value.<a name="line.99"></a>
+<span class="sourceLineNo">100</span>     * The simplest implementation is to
use a Map. However, virtually any<a name="line.100"></a>
+<span class="sourceLineNo">101</span>     * implementation is possible.<a
name="line.101"></a>
+<span class="sourceLineNo">102</span>     * &lt;p&gt;<a name="line.102"></a>
+<span class="sourceLineNo">103</span>     * For example, it would be possible
to implement a lookup that used the<a name="line.103"></a>
+<span class="sourceLineNo">104</span>     * key as a primary key, and looked
up the value on demand from the database<a name="line.104"></a>
+<span class="sourceLineNo">105</span>     * Or, a numeric based implementation
could be created that treats the key<a name="line.105"></a>
+<span class="sourceLineNo">106</span>     * as an integer, increments the value
and return the result as a string -<a name="line.106"></a>
+<span class="sourceLineNo">107</span>     * converting 1 to 2, 15 to 16 etc.<a
name="line.107"></a>
+<span class="sourceLineNo">108</span>     * &lt;p&gt;<a name="line.108"></a>
+<span class="sourceLineNo">109</span>     * The {@link #lookup(String)} method
always returns a String, regardless of<a name="line.109"></a>
+<span class="sourceLineNo">110</span>     * the underlying data, by converting
it as necessary. For example:<a name="line.110"></a>
+<span class="sourceLineNo">111</span>     * &lt;pre&gt;<a name="line.111"></a>
+<span class="sourceLineNo">112</span>     * Map&amp;lt;String, Object&amp;gt;
map = new HashMap&amp;lt;String, Object&amp;gt;();<a name="line.112"></a>
+<span class="sourceLineNo">113</span>     * map.put("number", Integer.valueOf(2));<a
name="line.113"></a>
+<span class="sourceLineNo">114</span>     * assertEquals("2", StrLookup.mapLookup(map).lookup("number"));<a
name="line.114"></a>
+<span class="sourceLineNo">115</span>     * &lt;/pre&gt;<a name="line.115"></a>
+<span class="sourceLineNo">116</span>     * @param key  the key to be looked
up, may be null<a name="line.116"></a>
+<span class="sourceLineNo">117</span>     * @return the matching value, null
if no match<a name="line.117"></a>
+<span class="sourceLineNo">118</span>     */<a name="line.118"></a>
+<span class="sourceLineNo">119</span>    public abstract String lookup(String
key);<a name="line.119"></a>
+<span class="sourceLineNo">120</span><a name="line.120"></a>
+<span class="sourceLineNo">121</span>    //-----------------------------------------------------------------------<a
name="line.121"></a>
+<span class="sourceLineNo">122</span>    /**<a name="line.122"></a>
+<span class="sourceLineNo">123</span>     * Lookup implementation that uses a
Map.<a name="line.123"></a>
+<span class="sourceLineNo">124</span>     */<a name="line.124"></a>
+<span class="sourceLineNo">125</span>    static class MapStrLookup&lt;V&gt;
extends StrLookup&lt;V&gt; {<a name="line.125"></a>
+<span class="sourceLineNo">126</span><a name="line.126"></a>
+<span class="sourceLineNo">127</span>        /** Map keys are variable names
and value. */<a name="line.127"></a>
+<span class="sourceLineNo">128</span>        private final Map&lt;String,
V&gt; map;<a name="line.128"></a>
+<span class="sourceLineNo">129</span><a name="line.129"></a>
+<span class="sourceLineNo">130</span>        /**<a name="line.130"></a>
+<span class="sourceLineNo">131</span>         * Creates a new instance backed
by a Map.<a name="line.131"></a>
+<span class="sourceLineNo">132</span>         *<a name="line.132"></a>
+<span class="sourceLineNo">133</span>         * @param map  the map of keys to
values, may be null<a name="line.133"></a>
+<span class="sourceLineNo">134</span>         */<a name="line.134"></a>
+<span class="sourceLineNo">135</span>        MapStrLookup(final Map&lt;String,
V&gt; map) {<a name="line.135"></a>
+<span class="sourceLineNo">136</span>            this.map = map;<a name="line.136"></a>
+<span class="sourceLineNo">137</span>        }<a name="line.137"></a>
+<span class="sourceLineNo">138</span><a name="line.138"></a>
+<span class="sourceLineNo">139</span>        /**<a name="line.139"></a>
+<span class="sourceLineNo">140</span>         * Looks up a String key to a String
value using the map.<a name="line.140"></a>
+<span class="sourceLineNo">141</span>         * &lt;p&gt;<a name="line.141"></a>
+<span class="sourceLineNo">142</span>         * If the map is null, then null
is returned.<a name="line.142"></a>
+<span class="sourceLineNo">143</span>         * The map result object is converted
to a string using toString().<a name="line.143"></a>
+<span class="sourceLineNo">144</span>         *<a name="line.144"></a>
+<span class="sourceLineNo">145</span>         * @param key  the key to be looked
up, may be null<a name="line.145"></a>
+<span class="sourceLineNo">146</span>         * @return the matching value, null
if no match<a name="line.146"></a>
+<span class="sourceLineNo">147</span>         */<a name="line.147"></a>
+<span class="sourceLineNo">148</span>        @Override<a name="line.148"></a>
+<span class="sourceLineNo">149</span>        public String lookup(final String
key) {<a name="line.149"></a>
+<span class="sourceLineNo">150</span>            if (map == null) {<a name="line.150"></a>
+<span class="sourceLineNo">151</span>                return null;<a name="line.151"></a>
+<span class="sourceLineNo">152</span>            }<a name="line.152"></a>
+<span class="sourceLineNo">153</span>            final Object obj = map.get(key);<a
name="line.153"></a>
+<span class="sourceLineNo">154</span>            if (obj == null) {<a name="line.154"></a>
+<span class="sourceLineNo">155</span>                return null;<a name="line.155"></a>
+<span class="sourceLineNo">156</span>            }<a name="line.156"></a>
+<span class="sourceLineNo">157</span>            return obj.toString();<a
name="line.157"></a>
+<span class="sourceLineNo">158</span>        }<a name="line.158"></a>
+<span class="sourceLineNo">159</span>    }<a name="line.159"></a>
+<span class="sourceLineNo">160</span><a name="line.160"></a>
+<span class="sourceLineNo">161</span>    //-----------------------------------------------------------------------<a
name="line.161"></a>
+<span class="sourceLineNo">162</span>    /**<a name="line.162"></a>
+<span class="sourceLineNo">163</span>     * Lookup implementation based on system
properties.<a name="line.163"></a>
+<span class="sourceLineNo">164</span>     */<a name="line.164"></a>
+<span class="sourceLineNo">165</span>    private static class SystemPropertiesStrLookup
extends StrLookup&lt;String&gt; {<a name="line.165"></a>
+<span class="sourceLineNo">166</span>        /**<a name="line.166"></a>
+<span class="sourceLineNo">167</span>         * {@inheritDoc} This implementation
directly accesses system properties.<a name="line.167"></a>
+<span class="sourceLineNo">168</span>         */<a name="line.168"></a>
+<span class="sourceLineNo">169</span>        @Override<a name="line.169"></a>
+<span class="sourceLineNo">170</span>        public String lookup(final String
key) {<a name="line.170"></a>
+<span class="sourceLineNo">171</span>            if (key.length() &gt; 0)
{<a name="line.171"></a>
+<span class="sourceLineNo">172</span>                try {<a name="line.172"></a>
+<span class="sourceLineNo">173</span>                    return System.getProperty(key);<a
name="line.173"></a>
+<span class="sourceLineNo">174</span>                } catch (final SecurityException
scex) {<a name="line.174"></a>
+<span class="sourceLineNo">175</span>                    // Squelched. All lookup(String)
will return null.<a name="line.175"></a>
+<span class="sourceLineNo">176</span>                }<a name="line.176"></a>
+<span class="sourceLineNo">177</span>            }<a name="line.177"></a>
+<span class="sourceLineNo">178</span>            return null;<a name="line.178"></a>
+<span class="sourceLineNo">179</span>        }<a name="line.179"></a>
+<span class="sourceLineNo">180</span>    }<a name="line.180"></a>
+<span class="sourceLineNo">181</span>}<a name="line.181"></a>
 
 
 

Modified: websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/StrMatcher.html
==============================================================================
--- websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/StrMatcher.html
(original)
+++ websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/StrMatcher.html
Sun Mar 12 02:08:01 2017
@@ -13,9 +13,9 @@
 <span class="sourceLineNo">005</span> * The ASF licenses this file to You under
the Apache License, Version 2.0<a name="line.5"></a>
 <span class="sourceLineNo">006</span> * (the "License"); you may not use this
file except in compliance with<a name="line.6"></a>
 <span class="sourceLineNo">007</span> * the License.  You may obtain a copy of
the License at<a name="line.7"></a>
-<span class="sourceLineNo">008</span> * <a name="line.8"></a>
+<span class="sourceLineNo">008</span> *<a name="line.8"></a>
 <span class="sourceLineNo">009</span> *      http://www.apache.org/licenses/LICENSE-2.0<a
name="line.9"></a>
-<span class="sourceLineNo">010</span> * <a name="line.10"></a>
+<span class="sourceLineNo">010</span> *<a name="line.10"></a>
 <span class="sourceLineNo">011</span> * Unless required by applicable law or
agreed to in writing, software<a name="line.11"></a>
 <span class="sourceLineNo">012</span> * distributed under the License is distributed
on an "AS IS" BASIS,<a name="line.12"></a>
 <span class="sourceLineNo">013</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.<a name="line.13"></a>
@@ -285,7 +285,7 @@
 <span class="sourceLineNo">277</span>         *<a name="line.277"></a>
 <span class="sourceLineNo">278</span>         * @param chars  the characters
to match, must not be null<a name="line.278"></a>
 <span class="sourceLineNo">279</span>         */<a name="line.279"></a>
-<span class="sourceLineNo">280</span>        CharSetMatcher(final char chars[])
{<a name="line.280"></a>
+<span class="sourceLineNo">280</span>        CharSetMatcher(final char[] chars)
{<a name="line.280"></a>
 <span class="sourceLineNo">281</span>            super();<a name="line.281"></a>
 <span class="sourceLineNo">282</span>            this.chars = chars.clone();<a
name="line.282"></a>
 <span class="sourceLineNo">283</span>            Arrays.sort(this.chars);<a
name="line.283"></a>
@@ -379,7 +379,7 @@
 <span class="sourceLineNo">371</span>            }<a name="line.371"></a>
 <span class="sourceLineNo">372</span>            return len;<a name="line.372"></a>
 <span class="sourceLineNo">373</span>        }<a name="line.373"></a>
-<span class="sourceLineNo">374</span>        <a name="line.374"></a>
+<span class="sourceLineNo">374</span><a name="line.374"></a>
 <span class="sourceLineNo">375</span>        @Override<a name="line.375"></a>
 <span class="sourceLineNo">376</span>        public String toString() {<a
name="line.376"></a>
 <span class="sourceLineNo">377</span>            return super.toString() + '
' + Arrays.toString(chars);<a name="line.377"></a>



Mime
View raw message