From 58287e3ff3b290ab4bb87d4023e2f50d94a65429 Mon Sep 17 00:00:00 2001 From: johnniang Date: Wed, 27 Mar 2019 14:15:25 +0800 Subject: [PATCH] Add EmailProperties --- .../halo/model/enums/EmailProperties.java | 41 +++++++++++++++++++ .../halo/model/enums/UpYunProperties.java | 8 +++- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/main/java/cc/ryanc/halo/model/enums/EmailProperties.java diff --git a/src/main/java/cc/ryanc/halo/model/enums/EmailProperties.java b/src/main/java/cc/ryanc/halo/model/enums/EmailProperties.java new file mode 100644 index 000000000..e079814cb --- /dev/null +++ b/src/main/java/cc/ryanc/halo/model/enums/EmailProperties.java @@ -0,0 +1,41 @@ +package cc.ryanc.halo.model.enums; + +/** + * Email properties. + * + * @author johnniang + * @date 3/27/19 + */ +public enum EmailProperties implements PropertyEnum { + + SMTP_HOST("email_smtp_host", String.class), + SMTP_USERNAME("email_smtp_username", String.class), + SMTP_PASSWORD("email_smtp_password", String.class), + FROM_NAME("email_from_name", String.class), + ENABLED("email_enabled", Boolean.class), + COMMENT_REPLY_NOTICE_ENABLED("email_comment_reply_notice_enabled", Boolean.class), + NEW_COMMENT_NOTICE_ENABLED("email_new_comment_notice_enabled", Boolean.class), + COMMENT_PASS_NOTICE_ENABLED("email_comment_pass_notice_enabled", Boolean.class); + + private final String value; + + private final Class type; + + EmailProperties(String value, Class type) { + if (!PropertyEnum.isSupportedType(type)) { + throw new IllegalArgumentException("Unsupported blog property type: " + type); + } + + this.value = value; + this.type = type; + } + + @Override + public Class getType() { + return null; + } + + @Override + public String getValue() { + return null; + }} diff --git a/src/main/java/cc/ryanc/halo/model/enums/UpYunProperties.java b/src/main/java/cc/ryanc/halo/model/enums/UpYunProperties.java index 5bbef99ef..b7d697adf 100644 --- a/src/main/java/cc/ryanc/halo/model/enums/UpYunProperties.java +++ b/src/main/java/cc/ryanc/halo/model/enums/UpYunProperties.java @@ -20,6 +20,10 @@ public enum UpYunProperties implements PropertyEnum { private Class type; UpYunProperties(String value, Class type) { + if (!PropertyEnum.isSupportedType(type)) { + throw new IllegalArgumentException("Unsupported blog property type: " + type); + } + this.value = value; this.type = type; } @@ -27,11 +31,11 @@ public enum UpYunProperties implements PropertyEnum { @Override public Class getType() { - return null; + return type; } @Override public String getValue() { - return null; + return value; } }