Git Product home page Git Product logo

sp-util's Introduction

SP-Util

The core functionality of this tool is similar to the method toString() in a java domain object, but it scan the @Mask annotation and masks the values of the confidential information. It will scan through the object graph deeper and finds the @Mask annotation and manipulates the values.

Installation

<dependency>
    <groupId>com.immibytes</groupId>
    <artifactId>sp-utils</artifactId>
    <version>1.0.0-RELEASE</version>
</dependency>

How to use

  1. Specify the annotation @Mask in the java domain object.
public class UserInfo{
   @Mask  
   private String emailId = "[email protected]";
   private boolean online = true;
   private List<ContactNumber> instances = new ArrayList<>();
}
  1. Initialize the MaskLogger and use the toString method, pass the domain object.
UserInfo instance = new UserInfo();
MaskLogger maskLogger= new MaskLogger();
String maskedString = maskLogger.toString(instance);
System.out.println(maskedString); // Print as: [emailId=XX, online=true,instances=[]]

Note: If you using it in the spring application, initialize using below

<bean id="maskLogger" class="com.immibytes.util.log.MaskLogger"/>

sp-util's People

Contributors

senthilaru avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sp-util's Issues

Exclude/Include package level feature in the MaskLogger

Provide an option to include or exclude base package of java domain object, this will improve the performance by avoiding iterating through the Java object graph.
If its excluded, it will simply return the toString() of the object provided.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.