Skip to content

Commit 5bc2d21

Browse files
committed
merge
2 parents e671371 + adb8b4c commit 5bc2d21

File tree

68 files changed

+4690
-1199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4690
-1199
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ build/
2222
nbbuild/
2323
dist/
2424
nbdist/
25-
.nb-gradle/
25+
.nb-gradle/
26+
/.idea

.idea/compiler.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.idea/encodings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/workspace.xml

Lines changed: 0 additions & 1157 deletions
This file was deleted.

pom.xml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,67 @@
3838

3939
<dependencies>
4040

41+
<!-- 微软office处理 api -->
42+
<dependency>
43+
<groupId>org.apache.poi</groupId>
44+
<artifactId>poi</artifactId>
45+
<version>3.6</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.apache.poi</groupId>
49+
<artifactId>poi-ooxml</artifactId>
50+
<version>3.6</version>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.apache.poi</groupId>
54+
<artifactId>poi-ooxml-schemas</artifactId>
55+
<version>3.6</version>
56+
</dependency>
57+
<!-- 微软office处理 api end -->
58+
59+
<dependency>
60+
<groupId>org.apache.httpcomponents</groupId>
61+
<artifactId>httpclient</artifactId>
62+
<version>4.5.2</version>
63+
</dependency>
64+
65+
<dependency>
66+
<groupId>commons-codec</groupId>
67+
<artifactId>commons-codec</artifactId>
68+
<version>1.6</version>
69+
</dependency>
70+
71+
<dependency>
72+
<groupId>commons-httpclient</groupId>
73+
<artifactId>commons-httpclient</artifactId>
74+
<version>3.0.1</version>
75+
</dependency>
76+
77+
<dependency>
78+
<groupId>com.alibaba</groupId>
79+
<artifactId>fastjson</artifactId>
80+
<version>1.2.49</version>
81+
</dependency>
82+
83+
<!-- 数据验证框架 -->
84+
<dependency>
85+
<groupId>net.sf.oval</groupId>
86+
<artifactId>oval</artifactId>
87+
<version>1.81</version>
88+
</dependency>
89+
<dependency>
90+
<groupId>com.alibaba.external</groupId>
91+
<artifactId>xml.xstream</artifactId>
92+
<version>1.3.1</version>
93+
</dependency>
94+
<!-- 数据验证框架 end-->
95+
96+
<dependency>
97+
<groupId>org.apache.commons</groupId>
98+
<artifactId>commons-lang3</artifactId>
99+
<version>3.6</version>
100+
</dependency>
101+
41102
<dependency>
42103
<groupId>org.springframework.boot</groupId>
43104
<artifactId>spring-boot-starter-web</artifactId>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package com.code.repository.study.classes;
2+
3+
/**
4+
*
5+
* Class.forName(xxx.xx.xx) 返回的是一个类, .newInstance() 后才创建一个对象.
6+
*
7+
* Class.forName(xxx.xx.xx);的作用是要求JVM查找并加载指定的类,也就是说JVM会执行该类的静态代码段。
8+
*
9+
* @author zhaoyuan.lizy
10+
*
11+
*/
12+
public class ClazzDemo {
13+
14+
// 父类A
15+
public class A{
16+
17+
public void aa(){
18+
System.out.println("A");
19+
}
20+
}
21+
22+
// 子类B
23+
public class B extends A{
24+
25+
public void aa(){
26+
System.out.println("B");
27+
}
28+
29+
}
30+
31+
// 子类C
32+
public class C extends A{
33+
34+
public void aa(){
35+
System.out.println("C");
36+
}
37+
38+
}
39+
40+
// 调用aa方法
41+
void showInnerClass(String name){
42+
try{
43+
A show=(A)Class.forName("com.alibaba.webx.study.my.classes."+name).newInstance();
44+
show.aa();
45+
}catch(Exception e){
46+
System.out.println ("showInnerClass Exception:"+e);
47+
}
48+
}
49+
50+
// 调用外部
51+
void show(String pathName){
52+
try {
53+
DemoA demo = (DemoA)Class.forName(pathName).newInstance();
54+
demo.aa();
55+
} catch (Exception e) {
56+
System.out.println ("show Exception:"+e);
57+
}
58+
}
59+
60+
public static void main(String[] args){
61+
ClazzDemo t=new ClazzDemo();
62+
t.showInnerClass("A");
63+
t.showInnerClass("B");
64+
t.showInnerClass("C");
65+
66+
t.show("com.alibaba.webx.study.my.classes.DemoA");
67+
}
68+
69+
70+
71+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.code.repository.study.classes;
2+
3+
public class DemoA {
4+
5+
static{ // Class.forName(xxx.xx.xx);调用该类时,JVM会执行该类的静态代码段。
6+
System.out.println("DemoA static method!");
7+
}
8+
9+
public void aa(){
10+
System.out.println("DemoA");
11+
}
12+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package com.code.repository.study.classloader;
2+
3+
import java.net.URL;
4+
5+
6+
/**
7+
* classLoader基本概念的实践
8+
*
9+
* @author zhaoyuan.lizy
10+
* 2012-8-10下午1:57:27
11+
*/
12+
public class ClassLoaderStudy {
13+
14+
public static void main(String[] args) {
15+
System.out.println(ClassLoader.getSystemClassLoader().getParent());
16+
System.out.println(ClassLoader.getSystemClassLoader().getParent().getParent());
17+
18+
}
19+
20+
/**
21+
* 获得系统属性
22+
*
23+
* @author zhaoyuan.lizy
24+
* 2012-8-15下午4:20:16
25+
*/
26+
private static void getProperty(){
27+
System.out.println("====查看bootstrapClassLoader加载的包");
28+
URL[] urls=sun.misc.Launcher.getBootstrapClassPath().getURLs();
29+
for (int i = 0; i < urls.length; i++) {
30+
System.out.println(urls[i].getFile());
31+
}
32+
//
33+
// System.out.println("\n====查看系统ClassPath包含的资源");
34+
// System.out.println(System.getProperty("java.class.path"));
35+
//
36+
// System.out.println("\n====查看Launcher的类加载器");
37+
// System.out.println("the Launcher's classloader is "+sun.misc.Launcher.getLauncher().getClass().getClassLoader());
38+
//
39+
// System.out.println("\n====加载该类的classLoader");
40+
// System.out.println(SimpleAction.class.getClassLoader().getClass().getName());
41+
//
42+
// System.out.println("\n====加载System的classLoader");
43+
// System.out.println(System.class.getClassLoader());
44+
//
45+
// System.out.println("\n====SystemClassLoader(AppClassLoader)的parent");
46+
// ClassLoader cl = ClassLoader.getSystemClassLoader();
47+
// System.out.println(cl);
48+
// System.out.println(cl.getParent());
49+
50+
// System.out.println("\n====系统属性 java.ext.dirs");
51+
// System.out.println(System.getProperty("java.ext.dirs"));
52+
// System.out.println(System.getProperty("java.security.manager"));
53+
// System.out.println("\n====系统所有属性");
54+
// Properties p = System.getProperties();
55+
// for(Object s :p.keySet()){
56+
// System.out.println(s.toString()+"====>"+System.getProperty(s.toString()));
57+
// }
58+
59+
}
60+
61+
/**
62+
* 自定义classLoader,加载自定义的classPath
63+
*
64+
* @author zhaoyuan.lizy
65+
* 2012-8-15下午4:43:05
66+
*/
67+
private static void userClassLoader(){
68+
69+
}
70+
}

0 commit comments

Comments
 (0)