docs(simple-jwt): Optimised Javadoc.

Closes #18
This commit is contained in:
Zihlu Wang
2023-10-18 00:40:46 +08:00
parent c0aa871765
commit 49f44fb2b7
2 changed files with 37 additions and 2 deletions
@@ -25,7 +25,8 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* JwtEnum
* This annotation marks the enum field declared in payload class will be
* handled as basic data types in {@link TokenDataType}.
*
* @author Zihlu Wang
*/
@@ -33,8 +34,16 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD})
public @interface TokenEnum {
/**
* The name of the field of the base data corresponding to the
* enumeration data.
*/
String propertyName();
/**
* The attribute {@code dataType} specifies what base data type to treat
* this enum as.
*/
TokenDataType dataType();
}
@@ -20,21 +20,47 @@ package cn.org.codecrafters.simplejwt.constants;
import lombok.Getter;
/**
* TokenDataType
* The base data types used to process enum data.
*
* @author Zihlu Wang
*/
@Getter
public enum TokenDataType {
/**
* Marks enumeration being processed as Boolean.
*/
BOOLEAN(Boolean.class),
/**
* Marks enumeration being processed as Double.
*/
DOUBLE(Long.class),
/**
* Marks enumeration being processed as Float.
*/
FLOAT(Float.class),
/**
* Marks enumeration being processed as Integer.
*/
INTEGER(Integer.class),
/**
* Marks enumeration being processed as Long.
*/
LONG(Long.class),
/**
* Marks enumeration being processed as String.
*/
STRING(String.class),
;
/**
* The mapped class to this mark.
*/
private final Class<?> mappedClass;
TokenDataType(Class<?> mappedClass) {