diff --git a/uno-core/src/main/java/cc/allio/uno/core/bean/BeanInfoWrapper.java b/uno-core/src/main/java/cc/allio/uno/core/bean/BeanInfoWrapper.java
index 1cd0b232..786896b1 100644
--- a/uno-core/src/main/java/cc/allio/uno/core/bean/BeanInfoWrapper.java
+++ b/uno-core/src/main/java/cc/allio/uno/core/bean/BeanInfoWrapper.java
@@ -1,12 +1,12 @@
package cc.allio.uno.core.bean;
+import cc.allio.uno.core.reflect.ReflectTools;
import cc.allio.uno.core.type.TypeValue;
import cc.allio.uno.core.type.Types;
-import cc.allio.uno.core.util.ClassUtils;
+import cc.allio.uno.core.util.Values;
import lombok.Getter;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
-import org.checkerframework.checker.units.qual.K;
import org.springframework.util.Assert;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -15,18 +15,19 @@
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
-import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Stream;
/**
* 增强对Bean对象的操作。禁止在Bean上添加{@link lombok.experimental.Accessors}的注解
*
required
*
- * - Bean必须要是Public
+ * - bean must visibility is public
+ * - bean must be has setter and getter methods
*
*
* @author j.x
@@ -63,6 +64,29 @@ public Flux findAll() {
});
}
+ /**
+ * find all property
+ *
+ * @return the property list
+ */
+ public List properties() {
+ AtomicReference> ref = new AtomicReference<>();
+ findAll().collectList().doOnNext(ref::set).subscribe();
+ return ref.get();
+ }
+
+ /**
+ * find all property name
+ *
+ * @return the name list
+ */
+ public List names() {
+ return Arrays.stream(beanInfo.getPropertyDescriptors())
+ .map(PropertyDescriptor::getName)
+ .filter(name -> !"class".equals(name))
+ .toList();
+ }
+
/**
* 根据字段名称查找这个字段对应的Descriptor
*
@@ -214,13 +238,12 @@ public synchronized K setCoverageForce(K target, String name, bool
public synchronized Mono setCoverage(K target, String name, boolean forceCoverage, Object... value) {
Assert.notNull(name, "target must not null");
return findByName(name)
- .flatMap(descriptor ->
- write(target, descriptor, forceCoverage, value)
- .onErrorContinue((error, o) -> {
- if (log.isWarnEnabled()) {
- log.warn("target {} setValue field {} value error setValue empty", target.getClass().getSimpleName(), name);
- }
- }));
+ .flatMap(descriptor -> write(target, descriptor, forceCoverage, value))
+ .onErrorContinue((error, o) -> {
+ if (log.isWarnEnabled()) {
+ log.warn("target {} setValue field {} value error setValue empty", target.getClass().getSimpleName(), name);
+ }
+ });
}
/**
@@ -260,27 +283,15 @@ private Mono