From 3db37ae19ea5222008932da41d0dc34565095b1b Mon Sep 17 00:00:00 2001 From: niushuai233 Date: Mon, 18 Dec 2023 15:25:35 +0800 Subject: [PATCH] feat: :100: prepare worked --- .gitignore | 55 +++++++++++------- pom.xml | 49 ++++++++++++++++ .../demo/designpattern/Application.java | 56 +++++++++++++++++++ 3 files changed, 139 insertions(+), 21 deletions(-) create mode 100644 pom.xml create mode 100644 src/main/java/cc/niushuai/demo/designpattern/Application.java diff --git a/.gitignore b/.gitignore index 9154f4c..b67af11 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..88ce694 --- /dev/null +++ b/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + cc.niushuai.demo + design-pattern + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + + + cn.hutool + hutool-all + 5.8.23 + + + + + + aliyun + https://maven.aliyun.com/repository/public + + true + + + false + + + + + + aliyun-plugin + https://maven.aliyun.com/repository/public + + true + + + false + + + + \ No newline at end of file diff --git a/src/main/java/cc/niushuai/demo/designpattern/Application.java b/src/main/java/cc/niushuai/demo/designpattern/Application.java new file mode 100644 index 0000000..d3f1fed --- /dev/null +++ b/src/main/java/cc/niushuai/demo/designpattern/Application.java @@ -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> 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(); + } +}