Annotation Type Sensitive


  • @Retention(RUNTIME)
    @Target(FIELD)
    public @interface Sensitive
    This annotation is used to mark string attributes that contain sensitive information and should be masked when output to a log file, and encrypted when stored in a database.
    Author:
    sagar04
    • Field Summary

      Fields 
      Modifier and Type Fields Description
      static java.lang.String MASK_EMAIL_ADDRESS
      Mask for a email address.
      static java.lang.String MASK_PASSWORD
      Mask for a password or alphanumeric pin with various lengths (min length = 4, max length = 100): mask all characters
      static java.lang.String MASK_PHONE_NUMBER
      Mask for a phone number: XXX-XXX-dddd leave the last four digits unmasked
      static java.lang.String MASK_SSN
      MASK for a SSN: XXX-XX-dddd leave the last four digits unmasked
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.String mask
      The masking pattern that should be applied to the value of the annotated attribute.
      java.lang.String type
      The type of sensitive attribute.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      char character
      The character that should be used to mask the value of the annotated attribute.
    • Field Detail

      • MASK_PASSWORD

        static final java.lang.String MASK_PASSWORD
        Mask for a password or alphanumeric pin with various lengths (min length = 4, max length = 100): mask all characters
      • MASK_EMAIL_ADDRESS

        static final java.lang.String MASK_EMAIL_ADDRESS
        Mask for a email address. Masks every character before @
      • MASK_PHONE_NUMBER

        static final java.lang.String MASK_PHONE_NUMBER
        Mask for a phone number: XXX-XXX-dddd leave the last four digits unmasked
      • MASK_SSN

        static final java.lang.String MASK_SSN
        MASK for a SSN: XXX-XX-dddd leave the last four digits unmasked
    • Element Detail

      • type

        java.lang.String type
        The type of sensitive attribute. This may be needed to determine how to encrypt/decrypt the sensitive information.
        Returns:
        The attribute type
      • mask

        java.lang.String mask
        The masking pattern that should be applied to the value of the annotated attribute. The pattern is a regular expression that contains "(" and ")" surrounding the parts of the string that should be masked with "X"s.
        Returns:
        The masking pattern.
      • character

        char character
        The character that should be used to mask the value of the annotated attribute. The default character is 'X'.
        Returns:
        The masking character.
        Default:
        'X'