mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
add methods
This commit is contained in:
parent
c89b895618
commit
e05a3b19e0
@ -13,6 +13,7 @@
|
||||
* 【core 】 Singleton增加部分方法(pr#609@Gitee)
|
||||
* 【core 】 BeanUtil增加beanToMap重载(pr#2292@Github)
|
||||
* 【core 】 Assert增加对应的equals及notEquals方法(pr#612@Gitee)
|
||||
* 【core 】 Assert增加对应的equals及notEquals方法(pr#612@Gitee)
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【db 】 修复RedisDS无法设置maxWaitMillis问题(issue#I54TZ9@Gitee)
|
||||
|
@ -104,7 +104,7 @@ public class ObjectUtil {
|
||||
|
||||
int count;
|
||||
if (obj instanceof Iterator) {
|
||||
Iterator<?> iter = (Iterator<?>) obj;
|
||||
final Iterator<?> iter = (Iterator<?>) obj;
|
||||
count = 0;
|
||||
while (iter.hasNext()) {
|
||||
count++;
|
||||
@ -113,7 +113,7 @@ public class ObjectUtil {
|
||||
return count;
|
||||
}
|
||||
if (obj instanceof Enumeration) {
|
||||
Enumeration<?> enumeration = (Enumeration<?>) obj;
|
||||
final Enumeration<?> enumeration = (Enumeration<?>) obj;
|
||||
count = 0;
|
||||
while (enumeration.hasMoreElements()) {
|
||||
count++;
|
||||
@ -161,9 +161,9 @@ public class ObjectUtil {
|
||||
}
|
||||
|
||||
if (obj instanceof Iterator) {
|
||||
Iterator<?> iter = (Iterator<?>) obj;
|
||||
final Iterator<?> iter = (Iterator<?>) obj;
|
||||
while (iter.hasNext()) {
|
||||
Object o = iter.next();
|
||||
final Object o = iter.next();
|
||||
if (equal(o, element)) {
|
||||
return true;
|
||||
}
|
||||
@ -171,9 +171,9 @@ public class ObjectUtil {
|
||||
return false;
|
||||
}
|
||||
if (obj instanceof Enumeration) {
|
||||
Enumeration<?> enumeration = (Enumeration<?>) obj;
|
||||
final Enumeration<?> enumeration = (Enumeration<?>) obj;
|
||||
while (enumeration.hasMoreElements()) {
|
||||
Object o = enumeration.nextElement();
|
||||
final Object o = enumeration.nextElement();
|
||||
if (equal(o, element)) {
|
||||
return true;
|
||||
}
|
||||
@ -181,9 +181,9 @@ public class ObjectUtil {
|
||||
return false;
|
||||
}
|
||||
if (obj.getClass().isArray() == true) {
|
||||
int len = Array.getLength(obj);
|
||||
final int len = Array.getLength(obj);
|
||||
for (int i = 0; i < len; i++) {
|
||||
Object o = Array.get(obj, i);
|
||||
final Object o = Array.get(obj, i);
|
||||
if (equal(o, element)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class CellUtil {
|
||||
cellType = cell.getCellType();
|
||||
}
|
||||
|
||||
Object value;
|
||||
final Object value;
|
||||
switch (cellType) {
|
||||
case NUMERIC:
|
||||
value = new NumericCellValue(cell).getValue();
|
||||
@ -206,7 +206,7 @@ public class CellUtil {
|
||||
if (null == row) {
|
||||
return null;
|
||||
}
|
||||
Cell cell = row.getCell(cellIndex);
|
||||
final Cell cell = row.getCell(cellIndex);
|
||||
if (null == cell) {
|
||||
return new NullCell(row, cellIndex);
|
||||
}
|
||||
@ -262,7 +262,7 @@ public class CellUtil {
|
||||
* @param sheet {@link Sheet}
|
||||
* @param x 列号,从0开始
|
||||
* @param y 行号,从0开始
|
||||
* @return 是否是合并单元格
|
||||
* @return 是否是合并单元格,如果提供的sheet为{@code null},返回{@code false}
|
||||
*/
|
||||
public static boolean isMergedRegion(Sheet sheet, int x, int y) {
|
||||
if (sheet != null) {
|
||||
@ -285,6 +285,7 @@ public class CellUtil {
|
||||
* @param sheet {@link Sheet}
|
||||
* @param locationRef 单元格地址标识符,例如A11,B5
|
||||
* @return {@link CellRangeAddress}
|
||||
* @since 5.8.0
|
||||
*/
|
||||
public static CellRangeAddress getCellRangeAddress(Sheet sheet, String locationRef) {
|
||||
final CellLocation cellLocation = ExcelUtil.toLocation(locationRef);
|
||||
@ -296,6 +297,7 @@ public class CellUtil {
|
||||
*
|
||||
* @param cell {@link Cell}
|
||||
* @return {@link CellRangeAddress}
|
||||
* @since 5.8.0
|
||||
*/
|
||||
public static CellRangeAddress getCellRangeAddress(Cell cell) {
|
||||
return getCellRangeAddress(cell.getSheet(), cell.getColumnIndex(), cell.getRowIndex());
|
||||
@ -308,6 +310,7 @@ public class CellUtil {
|
||||
* @param x 列号,从0开始
|
||||
* @param y 行号,从0开始
|
||||
* @return {@link CellRangeAddress}
|
||||
* @since 5.8.0
|
||||
*/
|
||||
public static CellRangeAddress getCellRangeAddress(Sheet sheet, int x, int y) {
|
||||
if (sheet != null) {
|
||||
@ -331,7 +334,7 @@ public class CellUtil {
|
||||
* @param cellStyle {@link CellStyle}
|
||||
*/
|
||||
public static void setMergedRegionStyle(Cell cell, CellStyle cellStyle) {
|
||||
CellRangeAddress cellRangeAddress = getCellRangeAddress(cell);
|
||||
final CellRangeAddress cellRangeAddress = getCellRangeAddress(cell);
|
||||
if (cellRangeAddress != null) {
|
||||
setMergeCellStyle(cellStyle, cellRangeAddress, cell.getSheet());
|
||||
}
|
||||
@ -457,7 +460,7 @@ public class CellUtil {
|
||||
anchor.setRow1(cell.getRowIndex());
|
||||
anchor.setRow2(cell.getRowIndex() + 2);
|
||||
}
|
||||
Comment comment = drawing.createCellComment(anchor);
|
||||
final Comment comment = drawing.createCellComment(anchor);
|
||||
comment.setString(factory.createRichTextString(commentText));
|
||||
comment.setAuthor(StrUtil.nullToEmpty(commentAuthor));
|
||||
cell.setCellComment(comment);
|
||||
|
Loading…
Reference in New Issue
Block a user