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