code cleanup

This commit is contained in:
Shinsuke Sugaya 2023-10-04 21:34:08 +09:00
parent 6d89b3447c
commit a917f66f1b
6 changed files with 6 additions and 6 deletions

View file

@ -53,7 +53,7 @@ public class CharMappingService {
}
public OptionalEntity<CharMappingFile> getCharMappingFile(final String dictId) {
return dictionaryManager.getDictionaryFile(dictId).filter(file -> file instanceof CharMappingFile)
return dictionaryManager.getDictionaryFile(dictId).filter(CharMappingFile.class::isInstance)
.map(file -> OptionalEntity.of((CharMappingFile) file)).orElse(OptionalEntity.empty());
}

View file

@ -52,7 +52,7 @@ public class KuromojiService {
}
public OptionalEntity<KuromojiFile> getKuromojiFile(final String dictId) {
return dictionaryManager.getDictionaryFile(dictId).filter(file -> file instanceof KuromojiFile)
return dictionaryManager.getDictionaryFile(dictId).filter(KuromojiFile.class::isInstance)
.map(file -> OptionalEntity.of((KuromojiFile) file)).orElse(OptionalEntity.empty());
}

View file

@ -53,7 +53,7 @@ public class ProtwordsService {
}
public OptionalEntity<ProtwordsFile> getProtwordsFile(final String dictId) {
return dictionaryManager.getDictionaryFile(dictId).filter(file -> file instanceof ProtwordsFile)
return dictionaryManager.getDictionaryFile(dictId).filter(ProtwordsFile.class::isInstance)
.map(file -> OptionalEntity.of((ProtwordsFile) file)).orElse(OptionalEntity.empty());
}

View file

@ -53,7 +53,7 @@ public class StemmerOverrideService {
}
public OptionalEntity<StemmerOverrideFile> getStemmerOverrideFile(final String dictId) {
return dictionaryManager.getDictionaryFile(dictId).filter(file -> file instanceof StemmerOverrideFile)
return dictionaryManager.getDictionaryFile(dictId).filter(StemmerOverrideFile.class::isInstance)
.map(file -> OptionalEntity.of((StemmerOverrideFile) file)).orElse(OptionalEntity.empty());
}

View file

@ -53,7 +53,7 @@ public class StopwordsService {
}
public OptionalEntity<StopwordsFile> getStopwordsFile(final String dictId) {
return dictionaryManager.getDictionaryFile(dictId).filter(file -> file instanceof StopwordsFile)
return dictionaryManager.getDictionaryFile(dictId).filter(StopwordsFile.class::isInstance)
.map(file -> OptionalEntity.of((StopwordsFile) file)).orElse(OptionalEntity.empty());
}

View file

@ -52,7 +52,7 @@ public class SynonymService {
}
public OptionalEntity<SynonymFile> getSynonymFile(final String dictId) {
return dictionaryManager.getDictionaryFile(dictId).filter(file -> file instanceof SynonymFile)
return dictionaryManager.getDictionaryFile(dictId).filter(SynonymFile.class::isInstance)
.map(file -> OptionalEntity.of((SynonymFile) file)).orElse(OptionalEntity.empty());
}