This commit is contained in:
redkale
2024-08-05 16:15:18 +08:00
parent f1f8f653e4
commit 2733cbcc62
6 changed files with 52 additions and 18 deletions

View File

@@ -5,13 +5,12 @@
*/
package org.redkale.annotation;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* 标记参数bean
* 用于预编译时执行Convert.convertFrom方法
*
* @since 2.5.0
*/
@@ -19,4 +18,4 @@ import java.lang.annotation.*;
@Documented
@Target(TYPE)
@Retention(RUNTIME)
public @interface Bean {}
public @interface Serial {}

View File

@@ -6,7 +6,6 @@
package org.redkale.boot;
import java.util.List;
import org.redkale.annotation.Bean;
import org.redkale.boot.ClassFilter.FilterEntry;
import org.redkale.convert.Decodeable;
import org.redkale.convert.bson.BsonFactory;
@@ -14,6 +13,7 @@ import org.redkale.convert.json.*;
import org.redkale.persistence.Entity;
import org.redkale.source.*;
import org.redkale.util.Utility;
import org.redkale.annotation.Serial;
/**
* 执行一次Application.run提前获取所有动态类
@@ -42,12 +42,12 @@ public class PrepareCompiler {
final ClassFilter<?> entityFilter = new ClassFilter(application.getClassLoader(), Entity.class, Object.class);
final ClassFilter<?> entityFilter2 =
new ClassFilter(application.getClassLoader(), javax.persistence.Entity.class, Object.class);
final ClassFilter<?> beanFilter = new ClassFilter(application.getClassLoader(), Bean.class, Object.class);
final ClassFilter<?> beanFilter2 =
final ClassFilter<?> serialFilter = new ClassFilter(application.getClassLoader(), Serial.class, Object.class);
final ClassFilter<?> serialFilter2 =
new ClassFilter(application.getClassLoader(), org.redkale.util.Bean.class, Object.class);
final ClassFilter<?> filterFilter = new ClassFilter(application.getClassLoader(), null, FilterBean.class);
application.loadClassByFilters(entityFilter, beanFilter, filterFilter);
application.loadClassByFilters(entityFilter, serialFilter, filterFilter);
for (FilterEntry en : entityFilter.getFilterEntrys()) {
Class clz = en.getType();
@@ -91,7 +91,7 @@ public class PrepareCompiler {
} catch (Exception e) { // JsonFactory.loadDecoder可能会失败因为class可能包含抽象类字段,如ColumnValue.value字段
}
}
for (FilterEntry en : beanFilter.getFilterEntrys()) {
for (FilterEntry en : serialFilter.getFilterEntrys()) {
Class clz = en.getType();
if (Utility.isAbstractOrInterface(clz)) {
continue;
@@ -109,7 +109,7 @@ public class PrepareCompiler {
} catch (Exception e) { // JsonFactory.loadDecoder可能会失败因为class可能包含抽象类字段,如ColumnValue.value字段
}
}
for (FilterEntry en : beanFilter2.getFilterEntrys()) {
for (FilterEntry en : serialFilter2.getFilterEntrys()) {
Class clz = en.getType();
if (Utility.isAbstractOrInterface(clz)) {
continue;

View File

@@ -5,7 +5,7 @@
*/
package org.redkale.source;
import org.redkale.annotation.Bean;
import org.redkale.annotation.Serial;
/**
* FilterBean用于过滤条件 所有的FilterBean都必须可以转换成FilterNode <br>
@@ -18,5 +18,5 @@ import org.redkale.annotation.Bean;
* @see org.redkale.source.FilterGroup
* @author zhangjx
*/
@Bean
@Serial
public interface FilterBean {}

View File

@@ -5,9 +5,9 @@
*/
package org.redkale.source;
import org.redkale.annotation.Bean;
import org.redkale.convert.ConvertColumn;
import org.redkale.convert.json.JsonConvert;
import org.redkale.annotation.Serial;
/**
* 翻页对象与过滤条件Bean的组合对象
@@ -18,7 +18,7 @@ import org.redkale.convert.json.JsonConvert;
* @param <T> Bean类
* @since 2.7.0
*/
@Bean
@Serial
public class PageBean<T> {
@ConvertColumn(index = 1)

View File

@@ -5,15 +5,14 @@
*/
package org.redkale.util;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
/**
* 标记参数bean
* 标记参数 replace by {@link org.redkale.annotation.Serial}
*
* @see org.redkale.annotation.Bean
* @see org.redkale.annotation.Serial
* @since 2.5.0
*/
@Deprecated(since = "2.8.0")

View File

@@ -968,6 +968,24 @@ public final class Utility {
return true;
}
/**
* 字符串是否至少一个为空白
*
* @param strs 字符串集合
* @return 是否为空白
*/
public static boolean isAnyBlank(String... strs) {
if (strs == null || strs.length == 0) {
return false;
}
for (String str : strs) {
if (isBlank(str)) {
return true;
}
}
return false;
}
/**
* 是否不为空白
*
@@ -1009,6 +1027,24 @@ public final class Utility {
return str == null || str.length() == 0;
}
/**
* 字符串是否至少一个为空
*
* @param strs 字符串集合
* @return 是否为空
*/
public static boolean isAnyEmpty(CharSequence... strs) {
if (strs == null || strs.length == 0) {
return false;
}
for (CharSequence str : strs) {
if (isEmpty(str)) {
return true;
}
}
return false;
}
/**
* 是否不为空
*