Package com.tnsai.quality.security
Record Class SecretPattern
java.lang.Object
java.lang.Record
com.tnsai.quality.security.SecretPattern
- Record Components:
name- human-readable name for this secret typepattern- compiled regex that matches the secretplaceholder- redaction placeholder (e.g.[REDACTED:api_key])enabled- whether this pattern is active
public record SecretPattern(String name, Pattern pattern, String placeholder, boolean enabled)
extends Record
Defines a single secret detection pattern.
Each pattern has a name, a compiled regex, and a placeholder format
used when redacting matches (e.g. [REDACTED:api_key]).
- Since:
- 0.2.3
-
Constructor Summary
ConstructorsConstructorDescriptionSecretPattern(String name, Pattern pattern, String placeholder, boolean enabled) Compact constructor with validation. -
Method Summary
Modifier and TypeMethodDescriptionbooleanenabled()Returns the value of theenabledrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.static SecretPatternCreates an enabled pattern.pattern()Returns the value of thepatternrecord component.Returns the value of theplaceholderrecord component.final StringtoString()Returns a string representation of this record class.Creates a disabled copy of this pattern.Creates an enabled copy of this pattern.
-
Constructor Details
-
SecretPattern
Compact constructor with validation.
-
-
Method Details
-
of
Creates an enabled pattern.- Parameters:
name- human-readable nameregex- regex stringsecretType- type label used in placeholder- Returns:
- enabled SecretPattern
-
withDisabled
Creates a disabled copy of this pattern.- Returns:
- disabled SecretPattern
-
withEnabled
Creates an enabled copy of this pattern.- Returns:
- enabled SecretPattern
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
pattern
Returns the value of thepatternrecord component.- Returns:
- the value of the
patternrecord component
-
placeholder
Returns the value of theplaceholderrecord component.- Returns:
- the value of the
placeholderrecord component
-
enabled
public boolean enabled()Returns the value of theenabledrecord component.- Returns:
- the value of the
enabledrecord component
-