26 Ağustos 2019 Pazartesi

FileBasedConfiguration Sınıfı

constructor
Şöyle yaparız.
FileBasedConfigurationBuilder<FileBasedConfiguration> builder = ...;
FileBasedConfiguration config = builder.getConfiguration();
getList metodu
Şöyle yaparız.
try {
  Object property = config.getList("...");
} catch (ConfigurationException cex) {
  ...
}
getProperty metodu
Şöyle yaparız.
try {
 final Object property1 = config.getProperty("...");
} catch (ConfigurationException cex) {
  ...
}
getString metodu
Şöyle yaparız.
try {
  config.getString("...");

} catch (ConfigurationException cex) {
  ...
}
setProperty metodu
Şöyle yaparız.
String bar = ...;
Configuration config = configBuilder.getConfiguration();
config.setProperty("foo", bar);

7 Ağustos 2019 Çarşamba

POI Excel XSSFTable Sınıfı

Giriş
Şu satırı dahil ederiz.
import org.apache.poi.xssf.usermodel.XSSFTable;
constructor
Şöyle yaparız.
XSSFSheet sheet = ...;

AreaReference areaReference = new AreaReference(
  new CellReference(0,0),
  new CellReference(10, 10,
    SpreadsheetVersion.EXCEL2007);

XSSFTable table = sheet.createTable(areaReference);

24 Temmuz 2019 Çarşamba

CaseInsensitiveMap Sınıfı

Giriş
Açıklaması şöyle.
A case-insensitive Map. Before keys are added to the map or compared to other existing keys, they are converted to all lowercase in a locale-independent fashion by using information from the Unicode data file.
Null keys are supported.
The keySet() method returns all lowercase keys, or nulls.

21 Temmuz 2019 Pazar

MultiValueMap Sınıfı - Kullanmayın

Giriş
Şu satırı dahil ederiz.
import org.apache.commons.collections4.MultiMap;
import org.apache.commons.collections4.map.MultiValueMap;
Bu sınıf yerine MultiValuedMap arayüzünden kalıtan sınıflardan birisi kullanılmalı.

put metodu
Şöyle yaparız.
MultiMap<String, String> multiMap = new MultiValueMap<>();
multiMap.put("a", "AA");
multiMap.put("a", "AAA");
multiMap.put("b", "B");
multiMap.put("b", "BB");

11 Temmuz 2019 Perşembe

POI Word XWPFParagraph Sınıfı

getParagraphText metodu
Şöyle yaparız
XWPFParagraph par = ...
if (par.getParagraphText().contains("\f")) {
  ...
}
getRuns metodu
Şöyle yaparız
XWPFTableRow tableRow = ...
for (XWPFTableCell cell : tableRow.getTableCells()) {
    for(XWPFParagraph paragraph : cell.getParagraphs()) {               
        for (XWPFRun run : paragraph.getRuns()) {
            run.setText("Cell"+j++,0);
        }           
    }       
}
isPageBreak metodu
Örnek ver