Browse Source

feat: 💯 prepare worked

master
niushuai233 1 year ago
parent
commit
3db37ae19e
  1. 55
      .gitignore
  2. 49
      pom.xml
  3. 56
      src/main/java/cc/niushuai/demo/designpattern/Application.java

55
.gitignore vendored

@ -1,26 +1,39 @@ @@ -1,26 +1,39 @@
# ---> Java
# Compiled class file
*.class
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
# Log file
*.log
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
.idea/*
# BlueJ files
*.ctxt
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
# Mobile Tools for Java (J2ME)
.mtj.tmp/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

49
pom.xml

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cc.niushuai.demo</groupId>
<artifactId>design-pattern</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.23</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>aliyun</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>aliyun-plugin</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

56
src/main/java/cc/niushuai/demo/designpattern/Application.java

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
/*
* Copyright (C) 2023 niushuai233 niushuai.cc
*
* Licensed under the Apache License, Version 2.0 (the "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
*
* 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 cc.niushuai.demo.designpattern;
import cn.hutool.core.lang.ConsoleTable;
import cn.hutool.core.util.ClassUtil;
import java.util.Set;
/**
* main class
*
* @author niushuai233
* @date 2023/12/18 15:11
* @since 0.0.1
*/
public class Application {
public static final String AUTHOR = "niushuai233";
public static void main(String[] args) {
printAllClasses();
}
/**
* 控制台打印所有类
*
* @author niushuai233
* @date 2023/12/18 15:19
* @since 0.0.1
*/
private static void printAllClasses() {
Set<Class<?>> allUtils = ClassUtil.scanPackage("cc.niushuai.demo.designpattern");
final ConsoleTable consoleTable = ConsoleTable.create().addHeader("类名", "所在包");
for (Class<?> clazz : allUtils) {
consoleTable.addBody(clazz.getSimpleName(), clazz.getPackage().getName());
}
consoleTable.print();
}
}
Loading…
Cancel
Save