Compare commits
2 Commits
1.1.0
...
54e2f9dffb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54e2f9dffb | ||
|
|
1a9a158126 |
@@ -8,7 +8,7 @@
|
||||
|
||||
使用方法:
|
||||
|
||||
+ 在项目中放置jar包的地方把seq-1.0.0.jar、seq-1.0.0-sources.jar、seq-1.0.0-pom.xml复制过去
|
||||
+ 在项目中放置jar包的地方把seq-1.1.0.jar、seq-1.1.0-sources.jar、seq-1.1.0-pom.xml复制过去
|
||||
+ 在pom.xml中增加以下内容,然后执行maven命令:mvn clean
|
||||
|
||||
```xml
|
||||
@@ -50,9 +50,9 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<!-- ${project.basedir}表示当前项目的根目录 -->
|
||||
<file>${project.basedir}/lib/seq-1.0.0.jar</file>
|
||||
<pomFile>${pom.basedir}/lib/seq-1.0.0-pom.xml</pomFile>
|
||||
<sources>${project.basedir}/lib/seq-1.0.0-sources.jar</sources>
|
||||
<file>${project.basedir}/lib/seq-1.1.0.jar</file>
|
||||
<pomFile>${pom.basedir}/lib/seq-1.1.0-pom.xml</pomFile>
|
||||
<sources>${project.basedir}/lib/seq-1.1.0-sources.jar</sources>
|
||||
<repositoryLayout>default</repositoryLayout>
|
||||
<groupId>com.yanghuanglin</groupId>
|
||||
<artifactId>seq</artifactId>
|
||||
|
||||
@@ -50,6 +50,16 @@ public interface Generator {
|
||||
*/
|
||||
String generate(String key, String type, Integer minLength);
|
||||
|
||||
/**
|
||||
* 将{@link #generate(String, String)}得到的序号对象格式化为补零后的序号字符串。实际上只会用到{@link Sequences#getSeq()}属性
|
||||
*
|
||||
* @param sequences 生成的序号对象
|
||||
* @param minLength 序号数字最小长度
|
||||
* @param pattern 格式
|
||||
* @return 格式化后的字符串
|
||||
*/
|
||||
String format(Sequences sequences, Integer minLength, String pattern);
|
||||
|
||||
/**
|
||||
* 将生成的序号对象格式化为指定格式
|
||||
* <p/>
|
||||
|
||||
@@ -132,6 +132,11 @@ public class SequencesGenerator implements Generator {
|
||||
return sequences.format(minLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(Sequences sequences, Integer minLength, String pattern) {
|
||||
return format(sequences.getSeq(), minLength, pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(Long seq, Integer minLength, String pattern) {
|
||||
return format(seq, null, minLength, pattern);
|
||||
|
||||
Reference in New Issue
Block a user