From 036e63f5d57da3ef5acf37687d26639582678602 Mon Sep 17 00:00:00 2001 From: vvatanabe Date: Sun, 3 Sep 2023 17:36:03 +0900 Subject: [PATCH 1/2] refactor: Deprecate com.nulabinc.zxcvbn.Matcher and introduce new interface in com.nulabinc.zxcvbn.matchers --- .../java/com/nulabinc/zxcvbn/Matcher.java | 7 ++++++- .../nulabinc/zxcvbn/matchers/BaseMatcher.java | 1 - .../com/nulabinc/zxcvbn/matchers/Matcher.java | 21 +++++++++++++++++++ .../zxcvbn/matchers/OmnibusMatcher.java | 1 - 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/nulabinc/zxcvbn/matchers/Matcher.java diff --git a/src/main/java/com/nulabinc/zxcvbn/Matcher.java b/src/main/java/com/nulabinc/zxcvbn/Matcher.java index a4cb77b..e4fc9ee 100644 --- a/src/main/java/com/nulabinc/zxcvbn/Matcher.java +++ b/src/main/java/com/nulabinc/zxcvbn/Matcher.java @@ -3,6 +3,11 @@ import com.nulabinc.zxcvbn.matchers.Match; import java.util.List; +/** + * @deprecated This interface is deprecated. Use {@link com.nulabinc.zxcvbn.matchers.Matcher} + * instead. + */ +@Deprecated public interface Matcher { - public List execute(CharSequence password); + List execute(CharSequence password); } diff --git a/src/main/java/com/nulabinc/zxcvbn/matchers/BaseMatcher.java b/src/main/java/com/nulabinc/zxcvbn/matchers/BaseMatcher.java index 09a6c02..3812e3b 100644 --- a/src/main/java/com/nulabinc/zxcvbn/matchers/BaseMatcher.java +++ b/src/main/java/com/nulabinc/zxcvbn/matchers/BaseMatcher.java @@ -1,7 +1,6 @@ package com.nulabinc.zxcvbn.matchers; import com.nulabinc.zxcvbn.Context; -import com.nulabinc.zxcvbn.Matcher; import java.io.Serializable; import java.util.Collections; import java.util.Comparator; diff --git a/src/main/java/com/nulabinc/zxcvbn/matchers/Matcher.java b/src/main/java/com/nulabinc/zxcvbn/matchers/Matcher.java new file mode 100644 index 0000000..78dcc07 --- /dev/null +++ b/src/main/java/com/nulabinc/zxcvbn/matchers/Matcher.java @@ -0,0 +1,21 @@ +package com.nulabinc.zxcvbn.matchers; + +import java.util.List; + +/** + * Represents a matcher responsible for identifying patterns within passwords. + * + *

Implementations of this interface provide specific matching strategies to detect various + * patterns such as dictionary words, sequences, and spatial patterns. + * + * @see Match + */ +public interface Matcher { + /** + * Analyzes the given password and returns a list of detected patterns as {@link Match} objects. + * + * @param password the password to analyze for patterns. + * @return a list of matches identifying patterns found within the password. + */ + List execute(CharSequence password); +} diff --git a/src/main/java/com/nulabinc/zxcvbn/matchers/OmnibusMatcher.java b/src/main/java/com/nulabinc/zxcvbn/matchers/OmnibusMatcher.java index 9a52962..368466d 100644 --- a/src/main/java/com/nulabinc/zxcvbn/matchers/OmnibusMatcher.java +++ b/src/main/java/com/nulabinc/zxcvbn/matchers/OmnibusMatcher.java @@ -1,7 +1,6 @@ package com.nulabinc.zxcvbn.matchers; import com.nulabinc.zxcvbn.Context; -import com.nulabinc.zxcvbn.Matcher; import java.util.ArrayList; import java.util.HashMap; import java.util.List; From 277331b036455494a849370682bdee9329dcaf2b Mon Sep 17 00:00:00 2001 From: vvatanabe Date: Sun, 3 Sep 2023 17:42:00 +0900 Subject: [PATCH 2/2] fix: checkstyle warnings (Summary javadoc is missin) --- src/main/java/com/nulabinc/zxcvbn/Matcher.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/nulabinc/zxcvbn/Matcher.java b/src/main/java/com/nulabinc/zxcvbn/Matcher.java index e4fc9ee..29cc1bc 100644 --- a/src/main/java/com/nulabinc/zxcvbn/Matcher.java +++ b/src/main/java/com/nulabinc/zxcvbn/Matcher.java @@ -4,6 +4,11 @@ import java.util.List; /** + * Represents a matcher responsible for identifying patterns within passwords. + * + *

Implementations of this interface provide specific matching strategies to detect various + * patterns such as dictionary words, sequences, and spatial patterns. + * * @deprecated This interface is deprecated. Use {@link com.nulabinc.zxcvbn.matchers.Matcher} * instead. */