Skip to content

Commit

Permalink
update document
Browse files Browse the repository at this point in the history
  • Loading branch information
xuxueli committed Jan 20, 2024
1 parent 110a883 commit 57525d1
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 60 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.xuxueli.com/page/donate.html'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Please answer some questions before submitting your issue. Thanks!

### Which version of XXL-JOB do you using?

### Expected behavior

### Actual behavior

### Steps to reproduce the behavior

### Other information
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
**What kind of change does this PR introduce?** (check at least one)

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update
- [ ] Refactor
- [ ] Build-related changes
- [ ] Other, please describe:


**The description of the PR:**


**Other information:**
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


## Introduction
XXL-TOOL is a series of tools that keep Java efficient.
XXL-Tool is a Java tool library that makes Java development more efficient. The tools include "collection, cache, concurrency, string, IO, Excel, emoji ..." and so on.

XXL-TOOL 是一个Java工具类库,致力于让Java开发更高效。包含 “集合、缓存、并发、字符串、IO、Excel、Emoji……” 等数十个模块。

Expand Down
67 changes: 32 additions & 35 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?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>
Expand All @@ -8,10 +7,9 @@
<packaging>jar</packaging>

<name>${project.artifactId}</name>
<description>XXL-TOOL is a series of tools that keep Java efficient.</description>
<description>XXL-Tool is a Java tool library that makes Java development more efficient. The tools include "collection, cache, concurrency, string, IO, Excel, emoji ..." and so on.</description>
<url>https://www.xuxueli.com/</url>


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand All @@ -20,63 +18,62 @@
<maven.compiler.target>1.8</maven.compiler.target>
<maven.test.skip>true</maven.test.skip>

<slf4j-api.version>1.7.30</slf4j-api.version>
<junit.version>4.13</junit.version>

<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>

<poi.version>4.1.2</poi.version>
<gson.version>2.8.6</gson.version>
<quasar-core.version>0.7.10</quasar-core.version>
<!-- slf4j+junit(base) -->
<slf4j-api.version>2.0.11</slf4j-api.version>
<junit-jupiter.version>5.10.1</junit-jupiter.version>
<!-- gson -->
<gson.version>2.10.1</gson.version>
<!-- poi(excel) -->
<poi.version>5.2.5</poi.version>
<!-- quasar(fiber) -->
<quasar-core.version>0.7.9</quasar-core.version>
<quasar-maven-plugin.version>0.7.9</quasar-maven-plugin.version>


<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<maven-shade-plugin>3.2.2</maven-shade-plugin>
</properties>

<dependencies>

<!-- ********************** slf4j+junit(base) ********************** -->
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
</dependency>
<!-- junit(test) -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<!-- log4j(test) -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-api.version}</version>
<scope>test</scope>
</dependency>

<!-- ********************** for excel ********************** -->
<!-- poi -->
<!-- junit -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<!-- ********************** for emoji ********************** -->
<!-- gson -->
<!-- ********************** gson ********************** -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
<scope>provided</scope>
</dependency>

<!-- ********************** poi(excel) ********************** -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
<scope>provided</scope>
</dependency>

<!-- ********************** for fiber(ing) ********************** -->
<!-- ********************** quasar(fiber) ********************** -->
<!-- quasar -->
<dependency>
<groupId>co.paralleluniverse</groupId>
Expand All @@ -95,8 +92,8 @@

<licenses>
<license>
<name>GNU General Public License version 3</name>
<url>https://opensource.org/licenses/GPL-3.0</url>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.xxl.tool.core.time;
package com.xxl.tool.core;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -17,24 +17,25 @@
* @author xuxueli 2018-08-19 01:24:11
*/
public class DateTool {

// ---------------------- format parse ----------------------
private static Logger logger = LoggerFactory.getLogger(DateTool.class);

// ---------------------- format parse ----------------------
private static final String DATE_FORMAT = "yyyy-MM-dd";
private static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

private static final ThreadLocal<Map<String, DateFormat>> dateFormatThreadLocal = new ThreadLocal<Map<String, DateFormat>>();
private static DateFormat getDateFormat(String pattern) {
// valid
if (pattern==null || pattern.trim().length()==0) {
throw new IllegalArgumentException("pattern cannot be empty.");
}

// load DateFormat
Map<String, DateFormat> dateFormatMap = dateFormatThreadLocal.get();
if(dateFormatMap!=null && dateFormatMap.containsKey(pattern)){
return dateFormatMap.get(pattern);
}

// init
synchronized (dateFormatThreadLocal) {
if (dateFormatMap == null) {
dateFormatMap = new HashMap<String, DateFormat>();
Expand Down Expand Up @@ -108,12 +109,10 @@ public static Date parseDateTime(String dateString) {
* @param dateString
* @param pattern
* @return
* @throws ParseException
*/
public static Date parse(String dateString, String pattern) {
try {
Date date = getDateFormat(pattern).parse(dateString);
return date;
return getDateFormat(pattern).parse(dateString);
} catch (Exception e) {
logger.warn("parse date error, dateString = {}, pattern={}; errorMsg = {}", dateString, pattern, e.getMessage());
return null;
Expand Down
19 changes: 19 additions & 0 deletions src/test/java/com/xxl/tool/test/core/DateToolTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.xxl.tool.test.core;

import com.xxl.tool.core.DateTool;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;

public class DateToolTest {
private static Logger logger = LoggerFactory.getLogger(DateToolTest.class);

@Test
public void formatDateTimeTest() {
logger.info(DateTool.formatDateTime(new Date()));
logger.info(DateTool.formatDateTime(DateTool.addYears(new Date(), 1)));
}

}
14 changes: 0 additions & 14 deletions src/test/java/com/xxl/tool/test/core/time/DateToolTest.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import co.paralleluniverse.fibers.SuspendExecution;
import com.xxl.tool.fiber.callback.AbstractFiberCallback;
import com.xxl.tool.fiber.callback.impl.DemoFiberCallback;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/xxl/tool/test/fiber/NomalFiberTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.xxl.tool.fiber.test;
package com.xxl.tool.test.fiber;

import co.paralleluniverse.fibers.SuspendExecution;
import co.paralleluniverse.fibers.Suspendable;
import co.paralleluniverse.strands.Strand;
import co.paralleluniverse.strands.SuspendableRunnable;
import com.xxl.tool.fiber.FiberTool;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down

0 comments on commit 57525d1

Please sign in to comment.