静态工厂方法添加 @StaticFactoryMethod 注解。

dev
ZhouXY108 2023-04-15 14:01:46 +08:00
parent b14c03fc32
commit 65d77f35c1
1 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.io.Files; import com.google.common.io.Files;
import lombok.Getter; import lombok.Getter;
import xyz.zhouxy.plusone.commons.annotation.StaticFactoryMethod;
import xyz.zhouxy.plusone.exception.SysException; import xyz.zhouxy.plusone.exception.SysException;
public class FastDFSUtil { public class FastDFSUtil {
@ -149,21 +150,25 @@ public class FastDFSUtil {
} }
@Nonnull @Nonnull
@StaticFactoryMethod(FastDFSFile.class)
public static FastDFSFile of(@Nonnull File file) throws IOException { public static FastDFSFile of(@Nonnull File file) throws IOException {
return new FastDFSFile(file, null); return new FastDFSFile(file, null);
} }
@Nonnull @Nonnull
@StaticFactoryMethod(FastDFSFile.class)
public static FastDFSFile of(@Nonnull File file, @Nullable String author) throws IOException { public static FastDFSFile of(@Nonnull File file, @Nullable String author) throws IOException {
return new FastDFSFile(file, author); return new FastDFSFile(file, author);
} }
@Nonnull @Nonnull
@StaticFactoryMethod(FastDFSFile.class)
public static FastDFSFile of(@Nonnull String fileName, @Nonnull byte[] content) { public static FastDFSFile of(@Nonnull String fileName, @Nonnull byte[] content) {
return new FastDFSFile(fileName, content, null); return new FastDFSFile(fileName, content, null);
} }
@Nonnull @Nonnull
@StaticFactoryMethod(FastDFSFile.class)
public static FastDFSFile of(@Nonnull String fileName, @Nonnull byte[] content, @Nullable String author) { public static FastDFSFile of(@Nonnull String fileName, @Nonnull byte[] content, @Nullable String author) {
return new FastDFSFile(fileName, content, author); return new FastDFSFile(fileName, content, author);
} }