diff --git a/blade-core-log/src/main/java/org/springblade/core/log/model/LogApiVo.java b/blade-core-log/src/main/java/org/springblade/core/log/model/LogApiVo.java index 5262426..092d745 100644 --- a/blade-core-log/src/main/java/org/springblade/core/log/model/LogApiVo.java +++ b/blade-core-log/src/main/java/org/springblade/core/log/model/LogApiVo.java @@ -1,11 +1,11 @@ /** * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). *
- * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *
- * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/lgpl.html *
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/blade-core-log/src/main/java/org/springblade/core/log/model/LogErrorVo.java b/blade-core-log/src/main/java/org/springblade/core/log/model/LogErrorVo.java index 437ffd2..d7f11ba 100644 --- a/blade-core-log/src/main/java/org/springblade/core/log/model/LogErrorVo.java +++ b/blade-core-log/src/main/java/org/springblade/core/log/model/LogErrorVo.java @@ -1,11 +1,11 @@ /** * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). *
- * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *
- * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/lgpl.html *
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/blade-core-log/src/main/java/org/springblade/core/log/model/LogUsualVo.java b/blade-core-log/src/main/java/org/springblade/core/log/model/LogUsualVo.java index a908997..728f5d4 100644 --- a/blade-core-log/src/main/java/org/springblade/core/log/model/LogUsualVo.java +++ b/blade-core-log/src/main/java/org/springblade/core/log/model/LogUsualVo.java @@ -1,11 +1,11 @@ /** * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). *
- * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *
- * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.gnu.org/licenses/lgpl.html *
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/support/BladeBeanCopier.java b/blade-core-tool/src/main/java/org/springblade/core/tool/support/BaseBeanCopier.java similarity index 77% rename from blade-core-tool/src/main/java/org/springblade/core/tool/support/BladeBeanCopier.java rename to blade-core-tool/src/main/java/org/springblade/core/tool/support/BaseBeanCopier.java index 7b389a5..a8d590c 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/support/BladeBeanCopier.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/support/BaseBeanCopier.java @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2018-2028, DreamLu 卢春梦 (qq596392912@gmail.com). + *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.gnu.org/licenses/lgpl.html + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.springblade.core.tool.support;
import org.springblade.core.tool.utils.BeanUtil;
@@ -21,22 +36,29 @@ import java.util.Map;
*
* @author L.cm
*/
-public abstract class BladeBeanCopier {
+public abstract class BaseBeanCopier {
private static final BeanCopierKey KEY_FACTORY = (BeanCopierKey) KeyFactory.create(BeanCopierKey.class);
private static final Type CONVERTER = TypeUtils.parseType("org.springframework.cglib.core.Converter");
- private static final Type BEAN_COPIER = TypeUtils.parseType(BladeBeanCopier.class.getName());
+ private static final Type BEAN_COPIER = TypeUtils.parseType(BaseBeanCopier.class.getName());
private static final Signature COPY = new Signature("copy", Type.VOID_TYPE, new Type[]{Constants.TYPE_OBJECT, Constants.TYPE_OBJECT, CONVERTER});
private static final Signature CONVERT = TypeUtils.parseSignature("Object convert(Object, Class, Object)");
interface BeanCopierKey {
+ /**
+ * 实例化
+ * @param source
+ * @param target
+ * @param useConverter
+ * @return
+ */
Object newInstance(String source, String target, boolean useConverter);
}
- public static BladeBeanCopier create(Class source, Class target, boolean useConverter) {
- return BladeBeanCopier.create(source, target, null, useConverter);
+ public static BaseBeanCopier create(Class source, Class target, boolean useConverter) {
+ return BaseBeanCopier.create(source, target, null, useConverter);
}
- public static BladeBeanCopier create(Class source, Class target, ClassLoader classLoader, boolean useConverter) {
+ public static BaseBeanCopier create(Class source, Class target, ClassLoader classLoader, boolean useConverter) {
Generator gen;
if (classLoader == null) {
gen = new Generator();
@@ -49,10 +71,16 @@ public abstract class BladeBeanCopier {
return gen.create();
}
+ /**
+ * 拷贝
+ * @param from
+ * @param to
+ * @param converter
+ */
abstract public void copy(Object from, Object to, Converter converter);
public static class Generator extends AbstractClassGenerator {
- private static final Source SOURCE = new Source(BladeBeanCopier.class.getName());
+ private static final Source SOURCE = new Source(BaseBeanCopier.class.getName());
private final ClassLoader classLoader;
private Class source;
private Class target;
@@ -97,9 +125,9 @@ public abstract class BladeBeanCopier {
return ReflectUtils.getProtectionDomain(source);
}
- public BladeBeanCopier create() {
+ public BaseBeanCopier create() {
Object key = KEY_FACTORY.newInstance(source.getName(), target.getName(), useConverter);
- return (BladeBeanCopier) super.create(key);
+ return (BaseBeanCopier) super.create(key);
}
@Override
@@ -120,7 +148,7 @@ public abstract class BladeBeanCopier {
// 2018.12.27 by L.cm 支持链式 bean
PropertyDescriptor[] getters = BeanUtil.getBeanGetters(source);
PropertyDescriptor[] setters = BeanUtil.getBeanSetters(target);
- Map