1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache license, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. 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 18 package org.apache.commons.text.lookup; 19 20 import org.apache.commons.lang3.StringUtils; 21 22 /** 23 * A default lookup for others to extend in this package. 24 * 25 * @since 1.3 26 */ 27 abstract class AbstractStringLookup implements StringLookup { 28 29 /** 30 * The default split char. 31 */ 32 protected static final char SPLIT_CH = ':'; 33 34 /** 35 * The default split string. 36 */ 37 protected static final String SPLIT_STR = String.valueOf(SPLIT_CH); 38 39 /** 40 * Creates a lookup key for a given file and key. 41 */ 42 static String toLookupKey(final String left, final String right) { 43 return toLookupKey(left, SPLIT_STR, right); 44 } 45 46 /** 47 * Creates a lookup key for a given file and key. 48 */ 49 static String toLookupKey(final String left, final String separator, final String right) { 50 return left + separator + right; 51 } 52 53 /** 54 * Returns the substring after the first occurrence of {@code ch} in {@code value}. 55 * 56 * @param value The source string. 57 * @param ch The character to search. 58 * @return a new string. 59 * @deprecated Use {@link StringUtils#substringAfter(String, int)}. 60 */ 61 @Deprecated 62 protected String substringAfter(final String value, final char ch) { 63 return StringUtils.substringAfter(value, ch); 64 } 65 66 /** 67 * Returns the substring after the first occurrence of {@code str} in {@code value}. 68 * 69 * @param value The source string. 70 * @param str The string to search. 71 * @return a new string. 72 * @deprecated Use {@link StringUtils#substringAfter(String, String)}. 73 */ 74 @Deprecated 75 protected String substringAfter(final String value, final String str) { 76 return StringUtils.substringAfter(value, str); 77 } 78 79 /** 80 * Returns the substring after the first occurrence of {@code ch} in {@code value}. 81 * 82 * @param value The source string. 83 * @param ch The character to search. 84 * @return a new string. 85 * @deprecated Use {@link StringUtils#substringAfterLast(String, int)}. 86 */ 87 @Deprecated 88 protected String substringAfterLast(final String value, final char ch) { 89 return StringUtils.substringAfterLast(value, ch); 90 } 91 92 }