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; 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 * @author Zihlu Wang
*/ */
@@ -33,8 +34,16 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
public @interface TokenEnum { public @interface TokenEnum {
/**
* The name of the field of the base data corresponding to the
* enumeration data.
*/
String propertyName(); String propertyName();
/**
* The attribute {@code dataType} specifies what base data type to treat
* this enum as.
*/
TokenDataType dataType(); TokenDataType dataType();
} }
@@ -20,21 +20,47 @@ package cn.org.codecrafters.simplejwt.constants;
import lombok.Getter; import lombok.Getter;
/** /**
* TokenDataType * The base data types used to process enum data.
* *
* @author Zihlu Wang * @author Zihlu Wang
*/ */
@Getter @Getter
public enum TokenDataType { public enum TokenDataType {
/**
* Marks enumeration being processed as Boolean.
*/
BOOLEAN(Boolean.class), BOOLEAN(Boolean.class),
/**
* Marks enumeration being processed as Double.
*/
DOUBLE(Long.class), DOUBLE(Long.class),
/**
* Marks enumeration being processed as Float.
*/
FLOAT(Float.class), FLOAT(Float.class),
/**
* Marks enumeration being processed as Integer.
*/
INTEGER(Integer.class), INTEGER(Integer.class),
/**
* Marks enumeration being processed as Long.
*/
LONG(Long.class), LONG(Long.class),
/**
* Marks enumeration being processed as String.
*/
STRING(String.class), STRING(String.class),
; ;
/**
* The mapped class to this mark.
*/
private final Class<?> mappedClass; private final Class<?> mappedClass;
TokenDataType(Class<?> mappedClass) { TokenDataType(Class<?> mappedClass) {