*/
package org.sonar.persistence.resource;
-import com.google.common.collect.Lists;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.persistence.DatabaseUtils;
import org.sonar.persistence.MyBatis;
-import java.util.List;
-
public class ResourceIndexerDao {
public static final int MINIMUM_KEY_SIZE = 3;
public final String getString(String key) {
String value = properties.get(key);
- if (value==null) {
+ if (value == null) {
value = getDefaultValue(key);
}
return value;
/**
* Value is splitted by comma and trimmed.
- *
+ * <p/>
* Examples :
* <ul>
- * <li>"one,two,three " -> ["one", "two", "three"]</li>
- * <li>" one, two, three " -> ["one", "two", "three"]</li>
- * <li>"one, , three" -> ["one", "", "three"]</li>
+ * <li>"one,two,three " -> ["one", "two", "three"]</li>
+ * <li>" one, two, three " -> ["one", "two", "three"]</li>
+ * <li>"one, , three" -> ["one", "", "three"]</li>
* </ul>
*/
public final String[] getStringArray(String key) {
public final String[] getStringArrayBySeparator(String key, String separator) {
String value = getString(key);
if (value != null) {
- String[] strings = StringUtils.splitByWholeSeparator(value, separator);
- String[] result = new String[strings.length];
- for (int index=0 ; index<strings.length ; index++) {
- result[index]=StringUtils.trim(strings[index]);
- }
- return result;
+ String[] strings = StringUtils.splitByWholeSeparator(value, separator);
+ String[] result = new String[strings.length];
+ for (int index = 0; index < strings.length; index++) {
+ result[index] = StringUtils.trim(strings[index]);
+ }
+ return result;
}
return ArrayUtils.EMPTY_STRING_ARRAY;
}