Skip to content

Commit

Permalink
Merge pull request #165 from nulab/move-matcher-interface
Browse files Browse the repository at this point in the history
refactor: Deprecate com.nulabinc.zxcvbn.Matcher and introduce new interface in com.nulabinc.zxcvbn.matchers
  • Loading branch information
vvatanabe authored Sep 3, 2023
2 parents 1f5f839 + 277331b commit 75fd7ce
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/main/java/com/nulabinc/zxcvbn/Matcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
import com.nulabinc.zxcvbn.matchers.Match;
import java.util.List;

/**
* Represents a matcher responsible for identifying patterns within passwords.
*
* <p>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.
*/
@Deprecated
public interface Matcher {
public List<Match> execute(CharSequence password);
List<Match> execute(CharSequence password);
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/com/nulabinc/zxcvbn/matchers/Matcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.nulabinc.zxcvbn.matchers;

import java.util.List;

/**
* Represents a matcher responsible for identifying patterns within passwords.
*
* <p>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<Match> execute(CharSequence password);
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 75fd7ce

Please sign in to comment.