yangys
2024-04-04 2cf2921440e7473ae50796c2cb688f609b3a7995
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.qianwen.core.tool.beans;
 
import java.security.ProtectionDomain;
import org.springframework.asm.ClassVisitor;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.cglib.core.AbstractClassGenerator;
import org.springframework.cglib.core.ReflectUtils;
 
/* loaded from: blade-core-tool-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tool/beans/BladeBeanMap.class */
public abstract class BladeBeanMap extends BeanMap {
    /* renamed from: newInstance */
    public abstract BladeBeanMap m4newInstance(Object o);
 
    protected BladeBeanMap() {
    }
 
    protected BladeBeanMap(Object bean) {
        super(bean);
    }
 
    public static BladeBeanMap create(Object bean) {
        BladeGenerator gen = new BladeGenerator();
        gen.setBean(bean);
        return gen.create();
    }
 
    /* loaded from: blade-core-tool-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tool/beans/BladeBeanMap$BladeGenerator.class */
    public static class BladeGenerator extends AbstractClassGenerator {
        private static final AbstractClassGenerator.Source SOURCE = new AbstractClassGenerator.Source(BladeBeanMap.class.getName());
        private Object bean;
        private Class beanClass;
        private int require;
 
        public BladeGenerator() {
            super(SOURCE);
        }
 
        public void setBean(Object bean) {
            this.bean = bean;
            if (bean != null) {
                this.beanClass = bean.getClass();
            }
        }
 
        public void setBeanClass(Class beanClass) {
            this.beanClass = beanClass;
        }
 
        public void setRequire(int require) {
            this.require = require;
        }
 
        protected ClassLoader getDefaultClassLoader() {
            return this.beanClass.getClassLoader();
        }
 
        protected ProtectionDomain getProtectionDomain() {
            return ReflectUtils.getProtectionDomain(this.beanClass);
        }
 
        public BladeBeanMap create() {
            if (this.beanClass == null) {
                throw new IllegalArgumentException("Class of bean unknown");
            }
            setNamePrefix(this.beanClass.getName());
            BladeBeanMapKey key = new BladeBeanMapKey(this.beanClass, this.require);
            return (BladeBeanMap) super.create(key);
        }
 
        public void generateClass(ClassVisitor v) throws Exception {
            new BladeBeanMapEmitter(v, getClassName(), this.beanClass, this.require);
        }
 
        protected Object firstInstance(Class type) {
            return ((BeanMap) ReflectUtils.newInstance(type)).newInstance(this.bean);
        }
 
        protected Object nextInstance(Object instance) {
            return ((BeanMap) instance).newInstance(this.bean);
        }
    }
}