Skip to content

Commit e609028

Browse files
committed
reactify-core docs
1 parent 112db7d commit e609028

34 files changed

+676
-175
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<groupId>io.github.hoangtien2k3</groupId>
1414
<artifactId>reactify-core</artifactId>
15-
<version>${reactify.version}</version>
15+
<version>1.1.5</version>
1616
<packaging>pom</packaging>
1717
<name>reactify-core</name>
1818
<description>Java library for developing backend with reactive programming</description>
@@ -251,7 +251,7 @@
251251
<artifactId>license-maven-plugin</artifactId>
252252
<version>4.0.rc2</version>
253253
<configuration>
254-
<header>src/main/resources/license-header.txt</header>
254+
<header>src/main/resources/header.txt</header>
255255
<includes>
256256
<include>**/*.java</include>
257257
</includes>

reactify/pom.xml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
<modelVersion>4.0.0</modelVersion>
55

66
<parent>
7-
<groupId>io.github.hoangtien2k3</groupId>
8-
<artifactId>reactify-core</artifactId>
9-
<version>${reactify.version}</version>
10-
<relativePath>../pom.xml</relativePath>
7+
<groupId>org.springframework.boot</groupId>
8+
<artifactId>spring-boot-starter-parent</artifactId>
9+
<version>3.3.3</version>
10+
<relativePath/>
1111
</parent>
1212

1313
<groupId>io.github.hoangtien2k3</groupId>
1414
<artifactId>reactify</artifactId>
15-
<version>${reactify.version}</version>
15+
<version>1.1.5</version>
1616
<packaging>jar</packaging>
1717
<name>reactify</name>
1818
<description>Java library for developing backend with reactive programming</description>
@@ -523,10 +523,14 @@
523523
<artifactId>license-maven-plugin</artifactId>
524524
<version>4.0.rc2</version>
525525
<configuration>
526-
<header>src/main/resources/header.txt</header>
527-
<includes>
528-
<include>**/*.java</include>
529-
</includes>
526+
<licenseSets>
527+
<licenseSet>
528+
<header>${project.basedir}/src/main/resources/header.txt</header>
529+
<includes>
530+
<include>**/*.java</include>
531+
</includes>
532+
</licenseSet>
533+
</licenseSets>
530534
</configuration>
531535
<executions>
532536
<execution>
@@ -536,6 +540,7 @@
536540
</execution>
537541
</executions>
538542
</plugin>
543+
539544
</plugins>
540545
</build>
541546

utils/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
<modelVersion>4.0.0</modelVersion>
55

66
<parent>
7-
<groupId>io.github.hoangtien2k3</groupId>
8-
<artifactId>reactify-core</artifactId>
9-
<version>${reactify.version}</version>
10-
<relativePath>../pom.xml</relativePath>
7+
<groupId>org.springframework.boot</groupId>
8+
<artifactId>spring-boot-starter-parent</artifactId>
9+
<version>3.3.3</version>
10+
<relativePath/>
1111
</parent>
1212

1313
<groupId>io.github.hoangtien2k3</groupId>
1414
<artifactId>utils</artifactId>
15-
<version>${reactify.version}</version>
15+
<version>1.1.5</version>
1616
<packaging>jar</packaging>
1717
<name>utils</name>
1818
<description>Java library for developing backend with reactive programming</description>

utils/src/main/java/io/hoangtien2k3/utils/AppUtils.java

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
* A utility class for handling reactive streams with various configurations.
2525
*
2626
* <p>
27-
* This class provides methods to execute {@link Mono} streams with different
28-
* configurations, including setting timeouts and handling errors. It uses a
29-
* bounded elastic scheduler for executing the streams.
27+
* This class provides methods to execute {@link reactor.core.publisher.Mono}
28+
* streams with different configurations, including setting timeouts and
29+
* handling errors. It uses a bounded elastic scheduler for executing the
30+
* streams.
3031
* </p>
3132
*
3233
* <p>
@@ -40,11 +41,12 @@
4041
public class AppUtils {
4142

4243
/**
43-
* Executes a {@link Mono} stream on a bounded elastic scheduler with a timeout
44-
* of 2 minutes. Logs any errors that occur during execution.
44+
* Executes a {@link reactor.core.publisher.Mono} stream on a bounded elastic
45+
* scheduler with a timeout of 2 minutes. Logs any errors that occur during
46+
* execution.
4547
*
4648
* @param functionMono
47-
* the {@link Mono} stream to be executed
49+
* the {@link reactor.core.publisher.Mono} stream to be executed
4850
*/
4951
public static void runHiddenStream(Mono<?> functionMono) {
5052
functionMono
@@ -55,11 +57,12 @@ public static void runHiddenStream(Mono<?> functionMono) {
5557
}
5658

5759
/**
58-
* Executes a {@link Mono} stream on a bounded elastic scheduler with a
59-
* specified timeout. Logs any errors that occur during execution.
60+
* Executes a {@link reactor.core.publisher.Mono} stream on a bounded elastic
61+
* scheduler with a specified timeout. Logs any errors that occur during
62+
* execution.
6063
*
6164
* @param functionMono
62-
* the {@link Mono} stream to be executed
65+
* the {@link reactor.core.publisher.Mono} stream to be executed
6366
* @param timeout
6467
* the timeout duration in minutes
6568
*/
@@ -72,11 +75,11 @@ public static void runHiddenStreamTimeout(Mono<?> functionMono, int timeout) {
7275
}
7376

7477
/**
75-
* Executes a {@link Mono} stream on a bounded elastic scheduler without any
76-
* timeout. Logs any errors that occur during execution.
78+
* Executes a {@link reactor.core.publisher.Mono} stream on a bounded elastic
79+
* scheduler without any timeout. Logs any errors that occur during execution.
7780
*
7881
* @param functionMono
79-
* the {@link Mono} stream to be executed
82+
* the {@link reactor.core.publisher.Mono} stream to be executed
8083
*/
8184
public static void runHiddenStreamWithoutTimeout(Mono<?> functionMono) {
8285
functionMono
@@ -86,14 +89,15 @@ public static void runHiddenStreamWithoutTimeout(Mono<?> functionMono) {
8689
}
8790

8891
/**
89-
* Executes a {@link Mono} stream and returns a {@link Mono} of {@code Boolean}
90-
* indicating success or failure. If the stream is empty, it returns
91-
* {@code true}. If an error occurs, it returns {@code false}.
92+
* Executes a {@link reactor.core.publisher.Mono} stream and returns a
93+
* {@link reactor.core.publisher.Mono} of {@code Boolean} indicating success or
94+
* failure. If the stream is empty, it returns {@code true}. If an error occurs,
95+
* it returns {@code false}.
9296
*
9397
* @param functionMono
94-
* the {@link Mono} stream to be executed
95-
* @return a {@link Mono} of {@code Boolean} indicating the result of the
96-
* operation
98+
* the {@link reactor.core.publisher.Mono} stream to be executed
99+
* @return a {@link reactor.core.publisher.Mono} of {@code Boolean} indicating
100+
* the result of the operation
97101
*/
98102
public static Mono<Boolean> insertData(Mono<?> functionMono) {
99103
return functionMono.map(rs -> true).switchIfEmpty(Mono.just(true)).onErrorResume(throwable -> Mono.just(false));

utils/src/main/java/io/hoangtien2k3/utils/DataUtil.java

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,96 +64,165 @@
6464
import org.xml.sax.InputSource;
6565
import reactor.core.publisher.Mono;
6666

67+
/**
68+
* <p>
69+
* DataUtil class.
70+
* </p>
71+
*
72+
* @author hoangtien2k3
73+
*/
6774
@Slf4j
6875
public class DataUtil {
6976
private static final Logger LOGGER = LoggerFactory.getLogger(DataUtil.class);
7077

78+
/** Constant <code>FORMAT_YMD</code> */
7179
public static final SimpleDateFormat FORMAT_YMD = new SimpleDateFormat(CommonConstant.DATE_FORMAT_YMD);
80+
/** Constant <code>FORMAT_DMY</code> */
7281
public static final SimpleDateFormat FORMAT_DMY = new SimpleDateFormat(CommonConstant.DATE_FORMAT_DMY);
82+
/** Constant <code>FORMAT_S_MY</code> */
7383
public static final SimpleDateFormat FORMAT_S_MY = new SimpleDateFormat(CommonConstant.DATE_FORMAT_S_MY);
84+
/** Constant <code>FORMAT_S_YM</code> */
7485
public static final SimpleDateFormat FORMAT_S_YM = new SimpleDateFormat(CommonConstant.DATE_FORMAT_S_YM);
86+
/** Constant <code>FORMAT_HH_MM</code> */
7587
public static final SimpleDateFormat FORMAT_HH_MM = new SimpleDateFormat(CommonConstant.DATE_FORMAT_HH_MM);
88+
/** Constant <code>FORMAT_HH_MM_24</code> */
7689
public static final SimpleDateFormat FORMAT_HH_MM_24 = new SimpleDateFormat(CommonConstant.DATE_FORMAT_HM);
7790

91+
/** Constant <code>FORMAT_DMYHMS_HYPHEN</code> */
7892
public static final SimpleDateFormat FORMAT_DMYHMS_HYPHEN =
7993
new SimpleDateFormat(CommonConstant.DATE_FORMAT_DMY_HMS);
94+
/** Constant <code>FORMAT_MDYHMS_12_HOUR</code> */
8095
public static final SimpleDateFormat FORMAT_MDYHMS_12_HOUR =
8196
new SimpleDateFormat(CommonConstant.DATE_FORMAT_MDY_HMS_12_HOUR);
97+
/** Constant <code>NUMBER_DF</code> */
8298
public static final DecimalFormat NUMBER_DF = new DecimalFormat("#.##");
99+
/** Constant <code>FORMAT_DMY_HYPHEN</code> */
83100
public static final SimpleDateFormat FORMAT_DMY_HYPHEN =
84101
new SimpleDateFormat(CommonConstant.FORMAT_DATE_DMY_HYPHEN);
102+
/** Constant <code>FORMAT_DMYHMS</code> */
85103
public static final SimpleDateFormat FORMAT_DMYHMS = new SimpleDateFormat(CommonConstant.DATE_FORMAT_DMYHMS);
104+
/** Constant <code>FORMAT_DMYHM</code> */
86105
public static final SimpleDateFormat FORMAT_DMYHM = new SimpleDateFormat(CommonConstant.DATE_FORMAT_DMYHM);
106+
/** Constant <code>FORMAT_DATE_FORMAT_YM2</code> */
87107
public static final SimpleDateFormat FORMAT_DATE_FORMAT_YM2 = new SimpleDateFormat(DATE_FORMAT_YM2);
108+
/** Constant <code>FORMAT_DATE_FORMAT_SHORT_YYYY</code> */
88109
public static final SimpleDateFormat FORMAT_DATE_FORMAT_SHORT_YYYY =
89110
new SimpleDateFormat(CommonConstant.DATE_FORMAT_SHORT_YYYY);
111+
/** Constant <code>FORMAT_YMD_T_HH_MM_SS</code> */
90112
public static final SimpleDateFormat FORMAT_YMD_T_HH_MM_SS =
91113
new SimpleDateFormat(CommonConstant.DATE_FORMAT_YMD_T_HH_MM_SS);
114+
/** Constant <code>FORMAT_YMD_T_HMS</code> */
92115
public static final SimpleDateFormat FORMAT_YMD_T_HMS = new SimpleDateFormat(CommonConstant.DATE_FORMAT_YMD_T_HMS);
116+
/** Constant <code>FORMAT_HMS</code> */
93117
public static final SimpleDateFormat FORMAT_HMS = new SimpleDateFormat(CommonConstant.DATE_FORMAT_HMS);
118+
/** Constant <code>FORMAT_SHORT</code> */
94119
public static final SimpleDateFormat FORMAT_SHORT = new SimpleDateFormat(CommonConstant.DATE_FORMAT_SHORT);
120+
/** Constant <code>FORMAT_HMS_NORMAL</code> */
95121
public static final SimpleDateFormat FORMAT_HMS_NORMAL =
96122
new SimpleDateFormat(CommonConstant.DATE_FORMAT_HMS_NORMAL);
123+
/** Constant <code>FORMAT_YDM_INSTANT</code> */
97124
public static final SimpleDateFormat FORMAT_YDM_INSTANT =
98125
new SimpleDateFormat(CommonConstant.DATE_FORMAT_YDM_INSTANT);
126+
/** Constant <code>FORMAT_DMY_HMS</code> */
99127
public static final SimpleDateFormat FORMAT_DMY_HMS = new SimpleDateFormat(CommonConstant.DATE_FORMAT_DMY_HMS);
128+
/** Constant <code>FORMAT_DATE</code> */
100129
public static final SimpleDateFormat FORMAT_DATE = new SimpleDateFormat(CommonConstant.DATE_FORMAT);
130+
/** Constant <code>FORMAT_DATE_2</code> */
101131
public static final SimpleDateFormat FORMAT_DATE_2 = new SimpleDateFormat(CommonConstant.DATE_FORMAT_2);
132+
/** Constant <code>FORMAT_DATE_3</code> */
102133
public static final SimpleDateFormat FORMAT_DATE_3 = new SimpleDateFormat(CommonConstant.DATE_FORMAT_3);
134+
/** Constant <code>FORMAT_YMD_HMS</code> */
103135
public static final SimpleDateFormat FORMAT_YMD_HMS = new SimpleDateFormat(CommonConstant.DATE_FORMAT_YMD_HMS);
136+
/** Constant <code>FORMAT_YMDHMS</code> */
104137
public static final SimpleDateFormat FORMAT_YMDHMS = new SimpleDateFormat(CommonConstant.DATE_FORMAT_YMDHMS);
138+
/** Constant <code>FORMAT_YMDH</code> */
105139
public static final SimpleDateFormat FORMAT_YMDH = new SimpleDateFormat(CommonConstant.DATE_FORMAT_YMDH);
140+
/** Constant <code>FORMAT_HMDMY</code> */
106141
public static final SimpleDateFormat FORMAT_HMDMY = new SimpleDateFormat(CommonConstant.DATE_TIME_FORMAT_HMDMY);
142+
/** Constant <code>FORMAT_YM2</code> */
107143
public static final SimpleDateFormat FORMAT_YM2 = new SimpleDateFormat(DATE_FORMAT_YM2);
144+
/** Constant <code>FORMAT_MD_HMS_END_DAY</code> */
108145
public static final SimpleDateFormat FORMAT_MD_HMS_END_DAY =
109146
new SimpleDateFormat(CommonConstant.DATE_FORMAT_END_DAY);
147+
/** Constant <code>FORMAT_YMD_HMS_BEGIN_DAY</code> */
110148
public static final SimpleDateFormat FORMAT_YMD_HMS_BEGIN_DAY =
111149
new SimpleDateFormat(CommonConstant.DATE_FORMAT_BEGIN_DAY);
150+
/** Constant <code>FORMAT_YMDTHMS_ZER0</code> */
112151
public static final SimpleDateFormat FORMAT_YMDTHMS_ZER0 =
113152
new SimpleDateFormat(CommonConstant.DATE_FORMAT_YMDTHMS_ZER0);
153+
/** Constant <code>FORMAT_YMDTHMS_ZER0_24HRS</code> */
114154
public static final SimpleDateFormat FORMAT_YMDTHMS_ZER0_24HRS =
115155
new SimpleDateFormat(CommonConstant.DATE_FORMAT_YMDTHMS_ZERO_24HRS);
156+
/** Constant <code>FORMAT_HM_DMY</code> */
116157
public static final SimpleDateFormat FORMAT_HM_DMY = new SimpleDateFormat(CommonConstant.DATE_FORMAT_HM_DMY);
158+
/** Constant <code>FORMAT_HM_DMY1</code> */
117159
public static final SimpleDateFormat FORMAT_HM_DMY1 = new SimpleDateFormat(CommonConstant.DATE_FORMAT_HM_DMY1);
160+
/** Constant <code>FORMAT_S_YMD</code> */
118161
public static final SimpleDateFormat FORMAT_S_YMD = new SimpleDateFormat(CommonConstant.DATE_FORMAT_S_YMD);
162+
/** Constant <code>FORMAT_S_YMD_HMS</code> */
119163
public static final SimpleDateFormat FORMAT_S_YMD_HMS = new SimpleDateFormat(CommonConstant.DATE_FORMAT_S_YMD_HMS);
164+
/** Constant <code>FORMAT_YMDTHMS_GMT_7</code> */
120165
public static final SimpleDateFormat FORMAT_YMDTHMS_GMT_7 =
121166
new SimpleDateFormat(CommonConstant.DATE_FORMAT_YMDTHMS_GMT_7);
167+
/** Constant <code>FORMAT_YMDTHMS_GMT_7_2</code> */
122168
public static final SimpleDateFormat FORMAT_YMDTHMS_GMT_7_2 =
123169
new SimpleDateFormat(CommonConstant.DATE_FORMAT_YMDTHMS_GMT_7_2);
170+
/** Constant <code>FORMAT_DATE_DMY_HM</code> */
124171
public static final SimpleDateFormat FORMAT_DATE_DMY_HM = new SimpleDateFormat(CommonConstant.DATE_FORMAT_DMY_HM);
172+
/** Constant <code>FORMAT_FORMAT_HM_DMY</code> */
125173
public static final SimpleDateFormat FORMAT_FORMAT_HM_DMY = new SimpleDateFormat(CommonConstant.DATE_FORMAT_HM_DMY);
174+
/** Constant <code>DATE_TIME_YMD</code> */
126175
public static final DateTimeFormatter DATE_TIME_YMD = DateTimeFormatter.ofPattern(CommonConstant.DATE_FORMAT_YMD);
176+
/** Constant <code>DATE_TIME_DMY_HMS</code> */
127177
public static final DateTimeFormatter DATE_TIME_DMY_HMS =
128178
DateTimeFormatter.ofPattern(CommonConstant.DATE_FORMAT_DMY_HMS);
179+
/** Constant <code>DATE_TIME_DMY</code> */
129180
public static final DateTimeFormatter DATE_TIME_DMY = DateTimeFormatter.ofPattern(CommonConstant.DATE_FORMAT_DMY);
181+
/** Constant <code>DATE_FORMAT_DMYHM</code> */
130182
public static final DateTimeFormatter DATE_FORMAT_DMYHM =
131183
DateTimeFormatter.ofPattern(CommonConstant.DATE_FORMAT_DMYHM);
184+
/** Constant <code>DATE_TIME_YMDTHMS_ZEO_24HRS</code> */
132185
public static final DateTimeFormatter DATE_TIME_YMDTHMS_ZEO_24HRS =
133186
DateTimeFormatter.ofPattern(CommonConstant.DATE_FORMAT_YMDTHMS_ZERO_24HRS);
187+
/** Constant <code>PATTERN_REGEX_PHONE_ASTERISK</code> */
134188
public static final Pattern PATTERN_REGEX_PHONE_ASTERISK = Pattern.compile(CommonConstant.REGEX_PHONE_ASTERISK);
189+
/** Constant <code>PATTERN_REGEX_NUMBER_PREFIX_CHECK</code> */
135190
public static final Pattern PATTERN_REGEX_NUMBER_PREFIX_CHECK =
136191
Pattern.compile(CommonConstant.COMMON_PREFIX.NUMBER_PREFIX);
192+
/** Constant <code>PATTERN_REGEX_ONLY_NUMBER_CHECK</code> */
137193
public static final Pattern PATTERN_REGEX_ONLY_NUMBER_CHECK =
138194
Pattern.compile(CommonConstant.COMMON_PREFIX.REGEX_ONLY_NUMBER);
195+
/** Constant <code>FORMAT_DATE_FORMAT</code> */
139196
public static final SimpleDateFormat FORMAT_DATE_FORMAT = new SimpleDateFormat(CommonConstant.DATE_FORMAT);
197+
/** Constant <code>FORMAT_DATE_FORMAT_MILI</code> */
140198
public static final SimpleDateFormat FORMAT_DATE_FORMAT_MILI =
141199
new SimpleDateFormat(CommonConstant.DATE_FORMAT_MILI);
200+
/** Constant <code>FORMAT_DATE_FORMAT_HM</code> */
142201
public static final SimpleDateFormat FORMAT_DATE_FORMAT_HM = new SimpleDateFormat(CommonConstant.DATE_FORMAT_HM);
202+
/** Constant <code>DATE_FORMAT_END_DAY</code> */
143203
public static final SimpleDateFormat DATE_FORMAT_END_DAY = new SimpleDateFormat(CommonConstant.DATE_FORMAT_END_DAY);
144204

205+
/** Constant <code>NUMBER_SEPARATOR_SYMBOL_FORMAT</code> */
145206
public static final DecimalFormatSymbols NUMBER_SEPARATOR_SYMBOL_FORMAT = new DecimalFormatSymbols();
207+
/** Constant <code>NUMBER_SEPARATOR_SYMBOL</code> */
146208
public static final DecimalFormat NUMBER_SEPARATOR_SYMBOL = new DecimalFormat("", NUMBER_SEPARATOR_SYMBOL_FORMAT);
209+
/** Constant <code>DECIMAL_FORMAT_NUMBER_SEPERATOR</code> */
147210
public static final DecimalFormat DECIMAL_FORMAT_NUMBER_SEPERATOR = new DecimalFormat("#,##0");
148211

212+
/** Constant <code>DECIMAL_FORMAT_SYMBOLS</code> */
149213
public static final DecimalFormatSymbols DECIMAL_FORMAT_SYMBOLS = new DecimalFormatSymbols(Locale.GERMAN);
214+
/** Constant <code>DECIMAL_FORMAT_NUMBER_COMMA</code> */
150215
public static final DecimalFormat DECIMAL_FORMAT_NUMBER_COMMA =
151216
new DecimalFormat("#,###,###,###.###", DECIMAL_FORMAT_SYMBOLS);
152217

218+
/** Constant <code>RANDOM</code> */
153219
public static final SecureRandom RANDOM = new SecureRandom();
154220

221+
/** Constant <code>TEXT_TIMEZONE_VN="Asia/Ha_Noi"</code> */
155222
public static final String TEXT_TIMEZONE_VN = "Asia/Ha_Noi";
223+
/** Constant <code>TIMEZONE_VN</code> */
156224
public static final TimeZone TIMEZONE_VN = TimeZone.getTimeZone(TEXT_TIMEZONE_VN);
225+
/** Constant <code>CALENDAR</code> */
157226
public static Calendar CALENDAR = Calendar.getInstance();
158227

159228
static {

0 commit comments

Comments
 (0)