use auto-boxing

This commit is contained in:
Shinsuke Sugaya 2020-03-20 14:13:51 +09:00
parent 26e4ca8bac
commit 90f6b52b9d
27 changed files with 40 additions and 44 deletions

View file

@ -154,13 +154,13 @@ public abstract class BaseJsonApiManager extends BaseApiManager {
}
buf.append('}');
} else if (obj instanceof Integer) {
buf.append(((Integer) obj).intValue());
buf.append(((Integer) obj));
} else if (obj instanceof Long) {
buf.append(((Long) obj).longValue());
buf.append(((Long) obj));
} else if (obj instanceof Float) {
buf.append(((Float) obj).floatValue());
buf.append(((Float) obj));
} else if (obj instanceof Double) {
buf.append(((Double) obj).doubleValue());
buf.append(((Double) obj));
} else if (obj instanceof Boolean) {
buf.append(obj.toString());
} else if (obj instanceof Date) {

View file

@ -281,8 +281,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
buf.append("<HAS>");
buf.append("<L/>");
buf.append("<C SZ=\"");
buf.append(DocumentUtil.getValue(document, fessConfig.getIndexFieldContentLength(), Long.class, Long.valueOf(0))
.longValue() / 1000);
buf.append(DocumentUtil.getValue(document, fessConfig.getIndexFieldContentLength(), Long.class, (long) 0).longValue() / 1000);
document.remove(fessConfig.getIndexFieldContentLength());
buf.append("k\" CID=\"");
buf.append(DocumentUtil.getValue(document, fessConfig.getIndexFieldDocId(), String.class));

View file

@ -182,7 +182,7 @@ public class CrawlingInfoService {
return crawlingInfoParamBhv.selectList(cb -> {
cb.query().setCrawlingInfoId_Equal(crawlingInfo.getId());
cb.query().addOrderBy_Id_Asc();
cb.paging(fessConfig.getPageCrawlingInfoParamMaxFetchSizeAsInteger().intValue(), 1);
cb.paging(fessConfig.getPageCrawlingInfoParamMaxFetchSizeAsInteger(), 1);
});
}

View file

@ -88,7 +88,7 @@ public class LabelTypeService extends FessAppService {
return labelTypeBhv.selectList(cb -> {
cb.query().addOrderBy_SortOrder_Asc();
cb.query().addOrderBy_Name_Asc();
cb.paging(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger().intValue(), 1);
cb.paging(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger(), 1);
});
}

View file

@ -90,7 +90,7 @@ public class RoleTypeService {
return roleTypeBhv.selectList(cb -> {
cb.query().addOrderBy_SortOrder_Asc();
cb.query().addOrderBy_Name_Asc();
cb.paging(fessConfig.getPageRoletypeMaxFetchSizeAsInteger().intValue(), 1);
cb.paging(fessConfig.getPageRoletypeMaxFetchSizeAsInteger(), 1);
});
}

View file

@ -55,7 +55,7 @@ public abstract class FessAdminAction extends FessBaseAction {
getUserBean().map(user -> user.hasRoles(fessConfig.getAuthenticationAdminRolesAsArray()) || user.hasRole(getActionRole()))
.orElse(false);
runtime.registerData("editable", editable);
runtime.registerData("editableClass", editable.booleanValue() ? StringUtil.EMPTY : "disabled");
runtime.registerData("editableClass", editable ? StringUtil.EMPTY : "disabled");
final String forumLink = systemHelper.getForumLink();
if (StringUtil.isNotBlank(forumLink)) {
runtime.registerData("forumLink", forumLink);

View file

@ -47,7 +47,7 @@ public class AccessToken extends BsAccessToken {
if (getExpiredTime() == null) {
return null;
}
return new Date(getExpiredTime().longValue());
return new Date(getExpiredTime());
}
public void setExpires(final Date date) {

View file

@ -68,7 +68,7 @@ public interface CrawlingConfig {
public enum ConfigType {
WEB("W"), FILE("F"), DATA("D");
private String typePrefix;
private final String typePrefix;
ConfigType(final String typePrefix) {
this.typePrefix = typePrefix;

View file

@ -62,7 +62,7 @@ public class ElevateWord extends BsElevateWord {
final ListResultBean<ElevateWordToLabel> mappingList = elevateWordToLabelBhv.selectList(cb -> {
cb.query().setElevateWordId_Equal(getId());
cb.specify().columnLabelTypeId();
cb.paging(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger().intValue(), 1);
cb.paging(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger(), 1);
});
final List<String> labelIdList = new ArrayList<>();
for (final ElevateWordToLabel mapping : mappingList) {

View file

@ -174,7 +174,7 @@ public class FileConfig extends BsFileConfig implements CrawlingConfig {
final String domain = map.get("domain");
smbAuth.setDomain(domain == null ? StringUtil.EMPTY : domain);
smbAuth.setServer(fileAuth.getHostname());
smbAuth.setPort(fileAuth.getPort() == null ? -1 : fileAuth.getPort().intValue());
smbAuth.setPort(fileAuth.getPort() == null ? -1 : fileAuth.getPort());
smbAuth.setUsername(fileAuth.getUsername());
smbAuth.setPassword(fileAuth.getPassword());
smbAuthList.add(smbAuth);
@ -183,7 +183,7 @@ public class FileConfig extends BsFileConfig implements CrawlingConfig {
new org.codelibs.fess.crawler.client.smb1.SmbAuthentication();
smb1Auth.setDomain(domain == null ? StringUtil.EMPTY : domain);
smb1Auth.setServer(fileAuth.getHostname());
smb1Auth.setPort(fileAuth.getPort() == null ? -1 : fileAuth.getPort().intValue());
smb1Auth.setPort(fileAuth.getPort() == null ? -1 : fileAuth.getPort());
smb1Auth.setUsername(fileAuth.getUsername());
smb1Auth.setPassword(fileAuth.getPassword());
smb1AuthList.add(smb1Auth);

View file

@ -86,7 +86,7 @@ public class WebAuthentication extends BsWebAuthentication {
if (getPort() == null) {
p = AuthScope.ANY_PORT;
} else {
p = getPort().intValue();
p = getPort();
}
String r = getAuthRealm();

View file

@ -30,8 +30,7 @@ public class AccessTokenHelper {
protected Random random = new SecureRandom();
public String generateAccessToken() {
return RandomStringUtils.random(ComponentUtil.getFessConfig().getApiAccessTokenLengthAsInteger().intValue(), 0, 0, true, true,
null, random);
return RandomStringUtils.random(ComponentUtil.getFessConfig().getApiAccessTokenLengthAsInteger(), 0, 0, true, true, null, random);
}
public String getAccessTokenFromRequest(final HttpServletRequest request) {

View file

@ -134,12 +134,12 @@ public class DocumentHelper {
protected int getMaxAlphanumTermSize() {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
return fessConfig.getCrawlerDocumentMaxAlphanumTermSizeAsInteger().intValue();
return fessConfig.getCrawlerDocumentMaxAlphanumTermSizeAsInteger();
}
protected int getMaxSymbolTermSize() {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
return fessConfig.getCrawlerDocumentMaxSymbolTermSizeAsInteger().intValue();
return fessConfig.getCrawlerDocumentMaxSymbolTermSizeAsInteger();
}
protected boolean isDuplicateTermRemoved() {

View file

@ -50,7 +50,7 @@ public class LanguageHelper {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
langFields = fessConfig.getIndexerLanguageFieldsAsArray();
supportedLanguages = fessConfig.getSupportedLanguagesAsArray();
maxTextLength = fessConfig.getIndexerLanguageDetectLengthAsInteger().intValue();
maxTextLength = fessConfig.getIndexerLanguageDetectLengthAsInteger();
}
public void updateDocument(final Map<String, Object> doc) {

View file

@ -73,10 +73,9 @@ public class PopularWordHelper {
final List<String> wordList = new ArrayList<>();
final SuggestHelper suggestHelper = ComponentUtil.getSuggestHelper();
final PopularWordsRequestBuilder popularWordsRequestBuilder =
suggestHelper.suggester().popularWords()
.setSize(fessConfig.getSuggestPopularWordSizeAsInteger().intValue())
.setWindowSize(fessConfig.getSuggestPopularWordWindowSizeAsInteger().intValue())
.setQueryFreqThreshold(fessConfig.getSuggestPopularWordQueryFreqAsInteger().intValue());
suggestHelper.suggester().popularWords().setSize(fessConfig.getSuggestPopularWordSizeAsInteger())
.setWindowSize(fessConfig.getSuggestPopularWordWindowSizeAsInteger())
.setQueryFreqThreshold(fessConfig.getSuggestPopularWordQueryFreqAsInteger());
popularWordsRequestBuilder.setSeed(baseSeed);
stream(baseTags).of(stream -> stream.forEach(tag -> popularWordsRequestBuilder.addTag(tag)));
stream(baseRoles).of(stream -> stream.forEach(role -> popularWordsRequestBuilder.addRole(role)));

View file

@ -318,7 +318,7 @@ public class SearchHelper {
}
}
builder.setQuery(boolQuery);
builder.setSize(fessConfig.getPagingSearchPageMaxSizeAsInteger().intValue());
builder.setSize(fessConfig.getPagingSearchPageMaxSizeAsInteger());
builder.setFetchSource(fields, null);
queryHelper.processSearchPreference(builder, userBean, String.join(StringUtil.EMPTY, docIds));
return true;

View file

@ -322,7 +322,7 @@ public class SearchLogHelper {
final String docId = clickLog.getDocId();
Integer countObj = clickCountMap.get(docId);
if (countObj == null) {
countObj = Integer.valueOf(1);
countObj = 1;
} else {
countObj = countObj.intValue() + 1;
}

View file

@ -354,7 +354,7 @@ public class SystemHelper {
}
public String abbreviateLongText(final String str) {
return StringUtils.abbreviate(str, ComponentUtil.getFessConfig().getMaxLogOutputLengthAsInteger().intValue());
return StringUtils.abbreviate(str, ComponentUtil.getFessConfig().getMaxLogOutputLengthAsInteger());
}
public String normalizeHtmlLang(final String value) {

View file

@ -540,8 +540,7 @@ public class ViewHelper {
} else {
createdStr = ComponentUtil.getMessageManager().getMessage(locale, "labels.search_unknown");
}
doc.put(CACHE_MSG, ComponentUtil.getMessageManager()
.getMessage(locale, "labels.search_cache_msg", new Object[] { url, createdStr }));
doc.put(CACHE_MSG, ComponentUtil.getMessageManager().getMessage(locale, "labels.search_cache_msg", url, createdStr));
doc.put(QUERIES, queries);

View file

@ -43,7 +43,7 @@ public class DocBoostMatcher {
final Object value = GroovyUtil.evaluate(matchExpression, map);
if (value instanceof Boolean) {
return ((Boolean) value).booleanValue();
return ((Boolean) value);
}
return false;
@ -60,7 +60,7 @@ public class DocBoostMatcher {
} else if (value instanceof Long) {
return ((Long) value).floatValue();
} else if (value instanceof Float) {
return ((Float) value).floatValue();
return ((Float) value);
} else if (value instanceof Double) {
return ((Double) value).floatValue();
} else if (value != null) {

View file

@ -156,7 +156,7 @@ public class IndexUpdater extends Thread {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final long updateInterval = fessConfig.getIndexerWebfsUpdateIntervalAsInteger().longValue();
final int maxEmptyListCount = fessConfig.getIndexerWebfsMaxEmptyListCountAsInteger().intValue();
final int maxEmptyListCount = fessConfig.getIndexerWebfsMaxEmptyListCountAsInteger();
final IntervalControlHelper intervalControlHelper = ComponentUtil.getIntervalControlHelper();
try {
final Consumer<SearchRequestBuilder> cb =
@ -169,7 +169,7 @@ public class IndexUpdater extends Thread {
org.codelibs.fess.crawler.Constants.OK_STATUS));
builder.setQuery(queryBuilder);
builder.setFrom(0);
final int maxDocumentCacheSize = fessConfig.getIndexerWebfsMaxDocumentCacheSizeAsInteger().intValue();
final int maxDocumentCacheSize = fessConfig.getIndexerWebfsMaxDocumentCacheSizeAsInteger();
builder.setSize(maxDocumentCacheSize <= 0 ? 1 : maxDocumentCacheSize);
builder.addSort(EsAccessResult.CREATE_TIME, SortOrder.ASC);
};

View file

@ -1140,7 +1140,7 @@ public class LdapManager {
controls.setReturningAttributes(returningAttrs);
}
long startTime = System.currentTimeMillis();
final long startTime = System.currentTimeMillis();
final List<SearchResult> list = Collections.list(holder.get().search(baseDn, filter, controls));
if (logger.isDebugEnabled()) {
logger.debug("LDAP search[{}ms]: {} - {}", System.currentTimeMillis() - startTime, baseDn, filter);

View file

@ -607,7 +607,7 @@ public interface FessProp {
default String getLdapSecurityPrincipal(final String username) {
final String value;
final int maxLength = getLdapMaxUsernameLengthAsInteger().intValue();
final int maxLength = getLdapMaxUsernameLengthAsInteger();
if (username == null) {
value = StringUtil.EMPTY;
} else if (maxLength >= 0 && username.length() > maxLength) {
@ -2044,7 +2044,7 @@ public interface FessProp {
value = Boolean.FALSE;
} else {
try {
value = Integer.valueOf(DfTypeUtil.toInteger(v));
value = DfTypeUtil.toInteger(v);
} catch (final NumberFormatException e) {
value = StringUtil.EMPTY;
}
@ -2057,7 +2057,7 @@ public interface FessProp {
Integer getProcessorsAsInteger();
default int availableProcessors() {
final int num = getProcessorsAsInteger().intValue();
final int num = getProcessorsAsInteger();
if (num > 0) {
return num;
}

View file

@ -123,7 +123,7 @@ public class FessFunctions {
if (value == null) {
return null;
}
return new Date(value.longValue());
return new Date(value);
}
public static Date parseDate(final String value) {

View file

@ -53,9 +53,9 @@ public class SystemMonitorTarget implements TimeoutTarget {
if (value == null) {
buf.append("null");
} else if (value instanceof Integer) {
buf.append(((Integer) value).intValue());
buf.append(((Integer) value));
} else if (value instanceof Long) {
buf.append(((Long) value).longValue());
buf.append(((Long) value));
} else if (value instanceof Short) {
buf.append(((Short) value).shortValue());
} else if (value instanceof double[]) {

View file

@ -45,7 +45,7 @@ public class QueryStringBuilder {
public String build() {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final int maxQueryLength = fessConfig.getQueryMaxLengthAsInteger().intValue();
final int maxQueryLength = fessConfig.getQueryMaxLengthAsInteger();
final StringBuilder queryBuf = new StringBuilder(255);
final String query = buildBaseQuery();
@ -133,7 +133,7 @@ public class QueryStringBuilder {
return;
}
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final int maxQueryLength = fessConfig.getQueryMaxLengthAsInteger().intValue();
final int maxQueryLength = fessConfig.getQueryMaxLengthAsInteger();
stream(conditions.get(SearchRequestParams.AS_OCCURRENCE)).of(
stream -> stream.filter(q -> isOccurrence(q)).findFirst().ifPresent(q -> queryBuf.insert(0, q + ":")));

View file

@ -84,7 +84,7 @@ public class ResourceUtil {
}
public static Path getConfOrClassesPath(final String... names) {
Path confPath = getConfPath(names);
final Path confPath = getConfPath(names);
if (Files.exists(confPath)) {
return confPath;
}