mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -38,6 +38,54 @@ public interface BeanDesc extends Serializable {
|
||||
*/
|
||||
Map<String, PropDesc> getPropMap(final boolean ignoreCase);
|
||||
|
||||
/**
|
||||
* 获取Bean属性数量
|
||||
*
|
||||
* @return 字段数量
|
||||
*/
|
||||
default int size(){
|
||||
return getPropMap(false).size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为空
|
||||
*
|
||||
* @return 是否为空
|
||||
*/
|
||||
default boolean isEmpty(){
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有可读字段,即有getter方法或public字段
|
||||
*
|
||||
* @param checkTransient 是否检查transient字段,true表示检查,false表示不检查
|
||||
* @return 是否有可读字段
|
||||
*/
|
||||
default boolean isReadable(final boolean checkTransient){
|
||||
for (final Map.Entry<String, PropDesc> entry : getPropMap(false).entrySet()) {
|
||||
if (entry.getValue().isReadable(checkTransient)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有可写字段,即有setter方法或public字段
|
||||
*
|
||||
* @param checkTransient 是否检查transient字段,true表示检查,false表示不检查
|
||||
* @return 是否有可写字段
|
||||
*/
|
||||
default boolean isWritable(final boolean checkTransient){
|
||||
for (final Map.Entry<String, PropDesc> entry : getPropMap(false).entrySet()) {
|
||||
if (entry.getValue().isWritable(checkTransient)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字段属性列表
|
||||
*
|
||||
|
@@ -311,7 +311,11 @@ public class TypeUtil {
|
||||
* @return {@link ParameterizedType}
|
||||
* @since 4.5.2
|
||||
*/
|
||||
public static ParameterizedType toParameterizedType(final Type type, final int interfaceIndex) {
|
||||
public static ParameterizedType toParameterizedType(Type type, final int interfaceIndex) {
|
||||
if(type instanceof TypeReference){
|
||||
type = ((TypeReference<?>) type).getType();
|
||||
}
|
||||
|
||||
if (type instanceof ParameterizedType) {
|
||||
return (ParameterizedType) type;
|
||||
}
|
||||
|
Reference in New Issue
Block a user