fix comment

This commit is contained in:
Looly 2019-10-09 09:30:22 +08:00
parent a418b5922b
commit b1674a933f
14 changed files with 278 additions and 228 deletions

View File

@ -30,6 +30,7 @@ public final class ProxyUtil {
* 使用切面代理对象 * 使用切面代理对象
* *
* @param <T> 被代理对象类型 * @param <T> 被代理对象类型
* @param target 被代理对象
* @param aspect 切面对象 * @param aspect 切面对象
* @return 代理对象 * @return 代理对象
*/ */

View File

@ -18,6 +18,7 @@ public abstract class ProxyFactory implements Serializable{
/** /**
* 创建代理 * 创建代理
* *
* @param <T> 代理对象类型
* @param target 被代理对象 * @param target 被代理对象
* @param aspect 切面实现 * @param aspect 切面实现
* @return 代理对象 * @return 代理对象

View File

@ -516,6 +516,7 @@ public abstract class AbstractDb implements Serializable {
* *
* @param <T> Bean类型 * @param <T> Bean类型
* @param where 条件实体类包含表名 * @param where 条件实体类包含表名
* @param beanClass 返回的对象类型
* @return 数据对象列表 * @return 数据对象列表
* @throws SQLException SQL执行异常 * @throws SQLException SQL执行异常
* @since 3.2.2 * @since 3.2.2

View File

@ -142,6 +142,7 @@ public abstract class DSFactory implements Closeable, Serializable{
* 此方法通过试错方式查找引入项目的连接池库按照优先级寻找一旦寻找到则创建对应的数据源工厂<br> * 此方法通过试错方式查找引入项目的连接池库按照优先级寻找一旦寻找到则创建对应的数据源工厂<br>
* 连接池优先级Hikari &gt; Druid &gt; Tomcat &gt; Dbcp &gt; C3p0 &gt; Hutool Pooled * 连接池优先级Hikari &gt; Druid &gt; Tomcat &gt; Dbcp &gt; C3p0 &gt; Hutool Pooled
* *
* @param setting 数据库配置项
* @return 日志实现类 * @return 日志实现类
*/ */
public static DSFactory create(Setting setting) { public static DSFactory create(Setting setting) {
@ -155,6 +156,7 @@ public abstract class DSFactory implements Closeable, Serializable{
* 此方法通过试错方式查找引入项目的连接池库按照优先级寻找一旦寻找到则创建对应的数据源工厂<br> * 此方法通过试错方式查找引入项目的连接池库按照优先级寻找一旦寻找到则创建对应的数据源工厂<br>
* 连接池优先级Hikari &gt; Druid &gt; Tomcat &gt; Dbcp &gt; C3p0 &gt; Hutool Pooled * 连接池优先级Hikari &gt; Druid &gt; Tomcat &gt; Dbcp &gt; C3p0 &gt; Hutool Pooled
* *
* @param setting 数据库配置项
* @return 日志实现类 * @return 日志实现类
* @since 4.1.3 * @since 4.1.3
*/ */

View File

@ -127,6 +127,7 @@ public class EmojiUtil {
* 例如<code>👦🏿</code> 转换为 <code>:boy|type_6:</code> * 例如<code>👦🏿</code> 转换为 <code>:boy|type_6:</code>
* *
* @param str 包含Emoji Unicode字符的字符串 * @param str 包含Emoji Unicode字符的字符串
* @param fitzpatrickAction {@link FitzpatrickAction}
* @return 替换后的字符串 * @return 替换后的字符串
*/ */
public static String toAlias(String str, FitzpatrickAction fitzpatrickAction) { public static String toAlias(String str, FitzpatrickAction fitzpatrickAction) {

View File

@ -35,25 +35,45 @@ import cn.hutool.core.util.StrUtil;
*/ */
public class Mail { public class Mail {
/** 邮箱帐户信息以及一些客户端配置信息 */ /**
* 邮箱帐户信息以及一些客户端配置信息
*/
private MailAccount mailAccount; private MailAccount mailAccount;
/** 收件人列表 */ /**
* 收件人列表
*/
private String[] tos; private String[] tos;
/** 抄送人列表carbon copy */ /**
* 抄送人列表carbon copy
*/
private String[] ccs; private String[] ccs;
/** 密送人列表blind carbon copy */ /**
* 密送人列表blind carbon copy
*/
private String[] bccs; private String[] bccs;
/** 回复地址(reply-to) */ /**
* 回复地址(reply-to)
*/
private String[] reply; private String[] reply;
/** 标题 */ /**
* 标题
*/
private String title; private String title;
/** 内容 */ /**
* 内容
*/
private String content; private String content;
/** 是否为HTML */ /**
* 是否为HTML
*/
private boolean isHtml; private boolean isHtml;
/** 正文、附件和图片的混合部分 */ /**
* 正文附件和图片的混合部分
*/
private Multipart multipart = new MimeMultipart(); private Multipart multipart = new MimeMultipart();
/** 是否使用全局会话默认为false */ /**
* 是否使用全局会话默认为false
*/
private boolean useGlobalSession = false; private boolean useGlobalSession = false;
/** /**
@ -76,6 +96,7 @@ public class Mail {
} }
// --------------------------------------------------------------- Constructor start // --------------------------------------------------------------- Constructor start
/** /**
* 构造使用全局邮件帐户 * 构造使用全局邮件帐户
*/ */
@ -95,6 +116,7 @@ public class Mail {
// --------------------------------------------------------------- Constructor end // --------------------------------------------------------------- Constructor end
// --------------------------------------------------------------- Getters and Setters start // --------------------------------------------------------------- Getters and Setters start
/** /**
* 设置收件人 * 设置收件人
* *
@ -254,6 +276,7 @@ public class Mail {
* *
* @param cid 图片与占位符占位符格式为cid:${cid} * @param cid 图片与占位符占位符格式为cid:${cid}
* @param imageStream 图片文件 * @param imageStream 图片文件
* @return this
* @since 4.6.3 * @since 4.6.3
*/ */
public Mail addImage(String cid, InputStream imageStream) { public Mail addImage(String cid, InputStream imageStream) {
@ -266,6 +289,7 @@ public class Mail {
* @param cid 图片与占位符占位符格式为cid:${cid} * @param cid 图片与占位符占位符格式为cid:${cid}
* @param imageStream 图片流不关闭 * @param imageStream 图片流不关闭
* @param contentType 图片类型null赋值默认的"image/jpeg" * @param contentType 图片类型null赋值默认的"image/jpeg"
* @return this
* @since 4.6.3 * @since 4.6.3
*/ */
public Mail addImage(String cid, InputStream imageStream, String contentType) { public Mail addImage(String cid, InputStream imageStream, String contentType) {
@ -284,6 +308,7 @@ public class Mail {
* *
* @param cid 图片与占位符占位符格式为cid:${cid} * @param cid 图片与占位符占位符格式为cid:${cid}
* @param imageFile 图片文件 * @param imageFile 图片文件
* @return this
* @since 4.6.3 * @since 4.6.3
*/ */
public Mail addImage(String cid, File imageFile) { public Mail addImage(String cid, File imageFile) {
@ -336,6 +361,7 @@ public class Mail {
} }
// --------------------------------------------------------------- Private method start // --------------------------------------------------------------- Private method start
/** /**
* 执行发送 * 执行发送
* *

View File

@ -247,7 +247,7 @@ public class MailAccount implements Serializable {
* *
* <pre> * <pre>
* 1. user@xxx.xx * 1. user@xxx.xx
* 2. name <user@xxx.xx> * 2. name &lt;user@xxx.xx&gt;
* </pre> * </pre>
* *
* @param from 发送方遵循RFC-822标准 * @param from 发送方遵循RFC-822标准
@ -272,6 +272,7 @@ public class MailAccount implements Serializable {
* 设置是否打开调试模式调试模式会显示与邮件服务器通信过程默认不开启 * 设置是否打开调试模式调试模式会显示与邮件服务器通信过程默认不开启
* *
* @param debug 是否打开调试模式调试模式会显示与邮件服务器通信过程默认不开启 * @param debug 是否打开调试模式调试模式会显示与邮件服务器通信过程默认不开启
* @return this
* @since 4.0.2 * @since 4.0.2
*/ */
public MailAccount setDebug(boolean debug) { public MailAccount setDebug(boolean debug) {

View File

@ -71,7 +71,7 @@ public class ServletUtil {
* @return Map * @return Map
*/ */
public static Map<String, String> getParamMap(ServletRequest request) { public static Map<String, String> getParamMap(ServletRequest request) {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<>();
for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) { for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) {
params.put(entry.getKey(), ArrayUtil.join(entry.getValue(), StrUtil.COMMA)); params.put(entry.getKey(), ArrayUtil.join(entry.getValue(), StrUtil.COMMA));
} }
@ -186,7 +186,6 @@ public class ServletUtil {
* 3Proxy-Client-IP * 3Proxy-Client-IP
* 4WL-Proxy-Client-IP * 4WL-Proxy-Client-IP
* </pre> * </pre>
* </p>
* *
* <p> * <p>
* otherHeaderNames参数用于自定义检测的Header<br> * otherHeaderNames参数用于自定义检测的Header<br>
@ -278,7 +277,7 @@ public class ServletUtil {
final Map<String, String> headerMap = new HashMap<>(); final Map<String, String> headerMap = new HashMap<>();
final Enumeration<String> names = request.getHeaderNames(); final Enumeration<String> names = request.getHeaderNames();
String name = null; String name;
while (names.hasMoreElements()) { while (names.hasMoreElements()) {
name = names.nextElement(); name = names.nextElement();
headerMap.put(name, request.getHeader(name)); headerMap.put(name, request.getHeader(name));
@ -297,7 +296,7 @@ public class ServletUtil {
*/ */
public static String getHeaderIgnoreCase(HttpServletRequest request, String nameIgnoreCase) { public static String getHeaderIgnoreCase(HttpServletRequest request, String nameIgnoreCase) {
final Enumeration<String> names = request.getHeaderNames(); final Enumeration<String> names = request.getHeaderNames();
String name = null; String name;
while (names.hasMoreElements()) { while (names.hasMoreElements()) {
name = names.nextElement(); name = names.nextElement();
if (name != null && name.equalsIgnoreCase(nameIgnoreCase)) { if (name != null && name.equalsIgnoreCase(nameIgnoreCase)) {
@ -347,9 +346,7 @@ public class ServletUtil {
String userAgent = getHeaderIgnoreCase(request, "User-Agent"); String userAgent = getHeaderIgnoreCase(request, "User-Agent");
if (StrUtil.isNotBlank(userAgent)) { if (StrUtil.isNotBlank(userAgent)) {
userAgent = userAgent.toUpperCase(); userAgent = userAgent.toUpperCase();
if (userAgent.contains("MSIE") || userAgent.contains("TRIDENT")) { return userAgent.contains("MSIE") || userAgent.contains("TRIDENT");
return true;
}
} }
return false; return false;
} }
@ -389,11 +386,7 @@ public class ServletUtil {
if (StrUtil.isBlank(contentType)) { if (StrUtil.isBlank(contentType)) {
return false; return false;
} }
if (contentType.toLowerCase().startsWith("multipart/")) { return contentType.toLowerCase().startsWith("multipart/");
return true;
}
return false;
} }
// --------------------------------------------------------- Header end // --------------------------------------------------------- Header end
@ -417,7 +410,7 @@ public class ServletUtil {
* @return Cookie map * @return Cookie map
*/ */
public static Map<String, Cookie> readCookieMap(HttpServletRequest httpServletRequest) { public static Map<String, Cookie> readCookieMap(HttpServletRequest httpServletRequest) {
Map<String, Cookie> cookieMap = new HashMap<String, Cookie>(); Map<String, Cookie> cookieMap = new HashMap<>();
Cookie[] cookies = httpServletRequest.getCookies(); Cookie[] cookies = httpServletRequest.getCookies();
if (null == cookies) { if (null == cookies) {
return null; return null;

View File

@ -22,7 +22,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
* 读取byte字节流在末尾抛出异常 * 读取byte字节流在末尾抛出异常
* *
* @return byte * @return byte
* @throws IOException * @throws IOException 读取异常
*/ */
public byte readByte() throws IOException { public byte readByte() throws IOException {
int i = super.read(); int i = super.read();
@ -53,7 +53,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
* 输入流中读取边界 * 输入流中读取边界
* *
* @return 边界 * @return 边界
* @throws IOException * @throws IOException 读取异常
*/ */
public byte[] readBoundary() throws IOException { public byte[] readBoundary() throws IOException {
ByteArrayOutputStream boundaryOutput = new ByteArrayOutputStream(1024); ByteArrayOutputStream boundaryOutput = new ByteArrayOutputStream(1024);
@ -91,7 +91,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
* *
* @param encoding 字符集 * @param encoding 字符集
* @return 头部信息 如果达到末尾则返回null * @return 头部信息 如果达到末尾则返回null
* @throws IOException * @throws IOException 读取异常
*/ */
public UploadFileHeader readDataHeader(String encoding) throws IOException { public UploadFileHeader readDataHeader(String encoding) throws IOException {
String dataHeader = readDataHeaderString(encoding); String dataHeader = readDataHeaderString(encoding);
@ -136,7 +136,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
* *
* @param out 输出流 * @param out 输出流
* @return 复制的字节数 * @return 复制的字节数
* @throws IOException * @throws IOException 读取异常
*/ */
public int copy(OutputStream out) throws IOException { public int copy(OutputStream out) throws IOException {
int count = 0; int count = 0;
@ -157,7 +157,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
* @param out 输出流 * @param out 输出流
* @param limit 最大字节数 * @param limit 最大字节数
* @return 复制的字节数 * @return 复制的字节数
* @throws IOException * @throws IOException 读取异常
*/ */
public int copy(OutputStream out, int limit) throws IOException { public int copy(OutputStream out, int limit) throws IOException {
int count = 0; int count = 0;
@ -195,7 +195,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
/** /**
* @param b byte * @param b byte
* @return 是否为边界的标志 * @return 是否为边界的标志
* @throws IOException * @throws IOException 读取异常
*/ */
public boolean isBoundary(byte b) throws IOException { public boolean isBoundary(byte b) throws IOException {
int boundaryLen = boundary.length; int boundaryLen = boundary.length;

View File

@ -81,6 +81,7 @@ public class UploadFile {
* 将上传的文件写入目标文件<br> * 将上传的文件写入目标文件<br>
* 写入后原临时文件会被删除 * 写入后原临时文件会被删除
* *
* @param destination 目标文件
* @return 目标文件 * @return 目标文件
*/ */
public File write(File destination) throws IOException { public File write(File destination) throws IOException {
@ -151,7 +152,7 @@ public class UploadFile {
// ---------------------------------------------------------------- properties // ---------------------------------------------------------------- properties
/** /**
* @return 上传文件的大小< 0 表示未上传 * @return 上传文件的大小&gt; 0 表示未上传
*/ */
public int size() { public int size() {
return size; return size;
@ -176,6 +177,7 @@ public class UploadFile {
* 处理上传表单流提取出文件 * 处理上传表单流提取出文件
* *
* @param input 上传表单的流 * @param input 上传表单的流
* @return 是否成功
* @throws IOException IO异常 * @throws IOException IO异常
*/ */
protected boolean processStream(MultipartRequestInputStream input) throws IOException { protected boolean processStream(MultipartRequestInputStream input) throws IOException {

View File

@ -32,27 +32,35 @@ public class UploadFileHeader {
/** /**
* Returns <code>true</code> if uploaded data are correctly marked as a file. This is true if header contains string 'filename'. * Returns <code>true</code> if uploaded data are correctly marked as a file. This is true if header contains string 'filename'.
*
* @return 是否为文件
*/ */
public boolean isFile() { public boolean isFile() {
return isFile; return isFile;
} }
/** /**
* Returns form field name. * 返回表单字段名
*
* @return 表单字段名
*/ */
public String getFormFieldName() { public String getFormFieldName() {
return formFieldName; return formFieldName;
} }
/** /**
* Returns complete file name as specified at client side. * 返回表单中的文件名来自客户端传入
*
* @return 表单文件名
*/ */
public String getFormFileName() { public String getFormFileName() {
return formFileName; return formFileName;
} }
/** /**
* Returns file name (base name and extension, without full path data). * 获取文件名不包括路径
*
* @return 文件名
*/ */
public String getFileName() { public String getFileName() {
return fileName; return fileName;
@ -62,6 +70,7 @@ public class UploadFileHeader {
* Returns uploaded content type. It is usually in the following form:<br> * Returns uploaded content type. It is usually in the following form:<br>
* mime_type/mime_subtype. * mime_type/mime_subtype.
* *
* @return content type
* @see #getMimeType() * @see #getMimeType()
* @see #getMimeSubtype() * @see #getMimeSubtype()
*/ */
@ -71,6 +80,8 @@ public class UploadFileHeader {
/** /**
* Returns file types MIME. * Returns file types MIME.
*
* @return types MIME
*/ */
public String getMimeType() { public String getMimeType() {
return mimeType; return mimeType;
@ -78,6 +89,8 @@ public class UploadFileHeader {
/** /**
* Returns file sub type MIME. * Returns file sub type MIME.
*
* @return sub type MIME
*/ */
public String getMimeSubtype() { public String getMimeSubtype() {
return mimeSubtype; return mimeSubtype;
@ -85,6 +98,8 @@ public class UploadFileHeader {
/** /**
* Returns content disposition. Usually it is 'form-data'. * Returns content disposition. Usually it is 'form-data'.
*
* @return content disposition
*/ */
public String getContentDisposition() { public String getContentDisposition() {
return contentDisposition; return contentDisposition;
@ -154,7 +169,8 @@ public class UploadFileHeader {
/** /**
* 处理头字符串使之转化为字段 * 处理头字符串使之转化为字段
* @param dataHeader *
* @param dataHeader 头字符串
*/ */
private void processHeaderString(String dataHeader) { private void processHeaderString(String dataHeader) {
isFile = dataHeader.indexOf("filename") > 0; isFile = dataHeader.indexOf("filename") > 0;

View File

@ -56,8 +56,8 @@ public class JSONConverter implements Converter<JSON> {
/** /**
* JSON递归转换<br> * JSON递归转换<br>
* 首先尝试JDK类型转换如果失败尝试JSON转Bean * 首先尝试JDK类型转换如果失败尝试JSON转Bean
* @param <T>
* *
* @param <T> 转换后的对象类型
* @param targetType 目标类型 * @param targetType 目标类型
* @param value * @param value
* @param ignoreError 是否忽略转换错误 * @param ignoreError 是否忽略转换错误

View File

@ -33,11 +33,11 @@ import cn.hutool.json.serialize.JSONSerializer;
* JSON工具类 * JSON工具类
* *
* @author Looly * @author Looly
*
*/ */
public final class JSONUtil { public final class JSONUtil {
// -------------------------------------------------------------------- Pause start // -------------------------------------------------------------------- Pause start
/** /**
* 创建JSONObject * 创建JSONObject
* *
@ -209,6 +209,7 @@ public final class JSONUtil {
// -------------------------------------------------------------------- Pause end // -------------------------------------------------------------------- Pause end
// -------------------------------------------------------------------- Read start // -------------------------------------------------------------------- Read start
/** /**
* 读取JSON * 读取JSON
* *
@ -247,6 +248,7 @@ public final class JSONUtil {
// -------------------------------------------------------------------- Read end // -------------------------------------------------------------------- Read end
// -------------------------------------------------------------------- toString start // -------------------------------------------------------------------- toString start
/** /**
* 转为JSON字符串 * 转为JSON字符串
* *
@ -357,6 +359,7 @@ public final class JSONUtil {
* @param <T> Bean类型 * @param <T> Bean类型
* @param jsonString JSON字符串 * @param jsonString JSON字符串
* @param typeReference {@link TypeReference}类型参考子类可以获取其泛型参数中的Type类型 * @param typeReference {@link TypeReference}类型参考子类可以获取其泛型参数中的Type类型
* @param ignoreError 是否忽略错误
* @return 实体类对象 * @return 实体类对象
* @since 4.3.2 * @since 4.3.2
*/ */
@ -370,6 +373,7 @@ public final class JSONUtil {
* @param <T> Bean类型 * @param <T> Bean类型
* @param jsonString JSON字符串 * @param jsonString JSON字符串
* @param beanType 实体类对象类型 * @param beanType 实体类对象类型
* @param ignoreError 是否忽略错误
* @return 实体类对象 * @return 实体类对象
* @since 4.3.2 * @since 4.3.2
*/ */
@ -412,6 +416,7 @@ public final class JSONUtil {
/** /**
* 将JSONArray转换为Bean的List默认为ArrayList * 将JSONArray转换为Bean的List默认为ArrayList
* *
* @param <T> Bean类型
* @param jsonArray JSONArray * @param jsonArray JSONArray
* @param elementType List中元素类型 * @param elementType List中元素类型
* @return List * @return List
@ -427,7 +432,7 @@ public final class JSONUtil {
* <li>.表达式可以获取Bean对象中的属性字段值或者Map中key对应的值</li> * <li>.表达式可以获取Bean对象中的属性字段值或者Map中key对应的值</li>
* <li>[]表达式可以获取集合等对象中对应index的值</li> * <li>[]表达式可以获取集合等对象中对应index的值</li>
* </ol> * </ol>
* * <p>
* 表达式栗子 * 表达式栗子
* *
* <pre> * <pre>
@ -454,7 +459,7 @@ public final class JSONUtil {
* <li>.表达式可以获取Bean对象中的属性字段值或者Map中key对应的值</li> * <li>.表达式可以获取Bean对象中的属性字段值或者Map中key对应的值</li>
* <li>[]表达式可以获取集合等对象中对应index的值</li> * <li>[]表达式可以获取集合等对象中对应index的值</li>
* </ol> * </ol>
* * <p>
* 表达式栗子 * 表达式栗子
* *
* <pre> * <pre>
@ -780,6 +785,7 @@ public final class JSONUtil {
} }
// --------------------------------------------------------------------------------------------- Private method start // --------------------------------------------------------------------------------------------- Private method start
/** /**
* 转义不可见字符<br> * 转义不可见字符<br>
* https://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF * https://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF

View File

@ -99,7 +99,7 @@ public final class Props extends Properties implements BasicTypeGetter<String>,
/** /**
* 构造使用相对于Class文件根目录的相对路径 * 构造使用相对于Class文件根目录的相对路径
* *
* @param path * @param path 配置文件路径相对于ClassPath或者使用绝对路径
*/ */
public Props(String path) { public Props(String path) {
this(path, CharsetUtil.CHARSET_ISO_8859_1); this(path, CharsetUtil.CHARSET_ISO_8859_1);