{"id":3145,"date":"2025-12-24T10:00:31","date_gmt":"2025-12-24T15:00:31","guid":{"rendered":"https:\/\/www.mymiller.name\/wordpress\/?p=3145"},"modified":"2025-12-24T10:00:31","modified_gmt":"2025-12-24T15:00:31","slug":"protecting-personal-information-when-needed","status":"publish","type":"post","link":"https:\/\/www.mymiller.name\/wordpress\/java\/protecting-personal-information-when-needed\/","title":{"rendered":"Protecting Personal Information when needed!"},"content":{"rendered":"\n<p>In today&#8217;s times, the software is always handling personal information.  As developers, we have to fight the battle between logging and seeing that information when we need to, and hiding that information when we need to.  In my case on my local developer box or on the QA system the information can be shown because it&#8217;s all fake.  However, when we go to a production system we need to hide that information.<\/p>\n\n\n\n<p>So I created the PiiInfo class.  a class designed to be used for displaying the real information when needed and hiding it when it should be. Very simple class, you can call a static method to set a Boolean Supplier to be used that will tell the class when it should show (true) or hide (false) the information.  By default when the information is hidden it will display [PII INFORMATION] instead of the real information.  This can be changed by calling PiiInfo::setPiiLabel(). By default, PiiInfo is set up to hide information all of the time.<br><\/p>\n\n\n\n<p>To set your own BooleanSupplier to be used call PiiInfo::setDecisionMaker() this will allow you to create your own decision-maker that can be based on the profile being used in spring, configuration setting, or another method of your choice to determine when to show the data.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package name.mymiller.io;\r\n\r\nimport java.util.function.BooleanSupplier;\r\n\r\n\r\n\/**\r\n * Class to use to protect Private Information. Takes a string and checks against a lambda to see\r\n * if the PII information should be displayed, otherwise display &#91;PII INFORMATION] in its place.\r\n * Defaults to hide PII Information.\r\n *\/\r\npublic class PiiInfo {\r\n    static Object syncObject = new Object();\r\n    static String PII_LABEL = \"&#91;PII INFORMATION]\";\r\n    static BooleanSupplier booleanSupplier = () -> {return false;};\r\n\r\n    \/**\r\n     * Static method to return a PiiInfo object set to display the correct text.\r\n     * @param information String that is the PII information that might be displayed in certain conditions.\r\n     * @return PiiInfo object to correctly display the information\r\n     *\/\r\n    static PiiInfo protect(String information) {\r\n        if(booleanSupplier.getAsBoolean()) {\r\n            return new PiiInfo(information);\r\n        }\r\n        return new PiiInfo(PiiInfo.PII_LABEL);\r\n    }\r\n\r\n    \/**\r\n     * Set the label to use for PII when hidden.\r\n     * @param label String containing the new label to replace &#91;PII INFORMATION]\r\n     *\/\r\n    public static void setPiiLabel(String label) {\r\n        synchronized (syncObject) {\r\n            PiiInfo.PII_LABEL = label;\r\n        }\r\n    }\r\n\r\n    \/**\r\n     * Setup a BooleanSupplier that will check conditiions to determine if PII information maybe displayed.\r\n     * Examples might to check if this is a Production environment and to hide all PII information and to\r\n     * display in test, development environments.\r\n     * @param booleanSupplier  returns TRUE to display the PII Information and FALSE to hide.\r\n     *\/\r\n    public static void setDecisionMaker(BooleanSupplier booleanSupplier) {\r\n        synchronized (syncObject) {\r\n            PiiInfo.booleanSupplier = booleanSupplier;\r\n        }\r\n    }\r\n\r\n    \/**\r\n     * Local variable to contain the text to display, defaults to the PII Label.\r\n     *\/\r\n    private String display = PiiInfo.PII_LABEL;\r\n\r\n    \/**\r\n     * Priviate Constructor to create the PiiINfo object\r\n     * @param display Data to display.\r\n     *\/\r\n    private PiiInfo(String display) {\r\n        this.display = display;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return this.display;\r\n    }\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>Using this is simply a change to your logging system.  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>log.debug(\"Email: {}\",PiiInfo.protect(email));<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In today&#8217;s times, the software is always handling personal information. As developers, we have to fight the battle between logging and seeing that information when we need to, and hiding that information when we need to. In my case on my local developer box or on the QA system the information can be shown because [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3146,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[280],"tags":[69],"series":[],"class_list":["post-3145","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-java-2"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2022\/01\/id-gef10e7986_640.jpg?fit=640%2C412&ssl=1","jetpack-related-posts":[{"id":2409,"url":"https:\/\/www.mymiller.name\/wordpress\/lambda_stream\/java-getter-setter-used-as-lamdas\/","url_meta":{"origin":3145,"position":0},"title":"Java getter\/setter used as Lamda&#8217;s","author":"Jeffery Miller","date":"December 23, 2025","format":false,"excerpt":"Once again I'm looking into ways to make coding so much easier. I needed to be able to pass in a Class::get and a Class:set as a Lamda in order to be able to reuse code across types. It's a rather simple process. However I have not found it really\u2026","rel":"","context":"In &quot;Lambda's and Streams&quot;","block_context":{"text":"Lambda's and Streams","link":"https:\/\/www.mymiller.name\/wordpress\/category\/lambda_stream\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2018\/10\/coffee-cup-2317201_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2018\/10\/coffee-cup-2317201_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2018\/10\/coffee-cup-2317201_640.jpg?fit=640%2C426&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3374,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_databases\/spring-data-with-java-records\/","url_meta":{"origin":3145,"position":1},"title":"Spring Data with Java Records","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Java records are a new feature introduced in Java 14 that provides a concise way to declare classes that are meant to hold immutable data. Spring Data is a popular framework for building data access layers in Java applications. In this answer, we will explain how to use Java records\u2026","rel":"","context":"In &quot;Spring Databases&quot;","block_context":{"text":"Spring Databases","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_databases\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/office-work-gc63fa3774_640.jpg?fit=640%2C430&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/office-work-gc63fa3774_640.jpg?fit=640%2C430&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/office-work-gc63fa3774_640.jpg?fit=640%2C430&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3148,"url":"https:\/\/www.mymiller.name\/wordpress\/java_tips\/java-tips-part-2\/","url_meta":{"origin":3145,"position":2},"title":"Java Tips Part 2","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Continuing my Java Tips from experience that I have learned from code reviews to different programming tasks. Tip 6: Don't call .toString() on slf4j logging calls. So if you're following my other tips and using the formatting option of the logging messages like this: list.parallelStream().filter(item -> !item.contains(\"BOB\")).forEach(item -> logger.debug(\"Item: {}\u2026","rel":"","context":"In &quot;Java Tips&quot;","block_context":{"text":"Java Tips","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java_tips\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2021\/12\/sam-dan-truong-rF4kuvgHhU-unsplash-scaled-e1640791434235.jpg?fit=640%2C427&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2021\/12\/sam-dan-truong-rF4kuvgHhU-unsplash-scaled-e1640791434235.jpg?fit=640%2C427&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2021\/12\/sam-dan-truong-rF4kuvgHhU-unsplash-scaled-e1640791434235.jpg?fit=640%2C427&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":2023,"url":"https:\/\/www.mymiller.name\/wordpress\/java\/simplifying-javafx-display-management-with-displaymanager\/","url_meta":{"origin":3145,"position":3},"title":"Simplifying JavaFX Display Management with DisplayManager","author":"Jeffery Miller","date":"April 20, 2026","format":false,"excerpt":"JavaFX provides a powerful platform for creating rich graphical user interfaces (GUIs) in Java applications. However, managing multiple displays and screens within a JavaFX application can be a complex task. To simplify this process and provide a flexible solution, we've developed the DisplayManager framework. In this article, we'll explore how\u2026","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/12\/board-1364650_640.jpg?fit=640%2C452&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/12\/board-1364650_640.jpg?fit=640%2C452&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/12\/board-1364650_640.jpg?fit=640%2C452&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3935,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_ai\/%f0%9f%9a%80-dl4j-and-spring-boot-real-time-anomaly-detection-in-time-series-data\/","url_meta":{"origin":3145,"position":4},"title":"\ud83d\ude80 DL4J and Spring Boot: Real-Time Anomaly Detection in Time-Series Data","author":"Jeffery Miller","date":"November 25, 2025","format":false,"excerpt":"As a Software Architect, you understand that an excellent solution requires not just a powerful model, but a robust, scalable, and performant architecture for deployment. The combination of DL4J (Deeplearning4j) and Spring Boot is perfectly suited for building real-time, high-performance services, especially for a critical task like time-series anomaly detection.\u2026","rel":"","context":"In &quot;Spring AI&quot;","block_context":{"text":"Spring AI","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_ai\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/11\/Gemini_Generated_Image_ek9cohek9cohek9c.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/11\/Gemini_Generated_Image_ek9cohek9cohek9c.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/11\/Gemini_Generated_Image_ek9cohek9cohek9c.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/11\/Gemini_Generated_Image_ek9cohek9cohek9c.avif 2x"},"classes":[]},{"id":3795,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_ai\/evrete-a-modern-java-rule-engine\/","url_meta":{"origin":3145,"position":5},"title":"EVRete: A Modern Java Rule Engine","author":"Jeffery Miller","date":"November 24, 2025","format":false,"excerpt":"EVRete is a high-performance, lightweight, and open-source rule engine designed for Java applications. It offers a flexible and expressive way to implement rule-based logic, making it a compelling alternative to traditional rule engines like Drools. This article delves into EVRete\u2019s features, focusing on its annotation-based approach to rule definition. Why\u2026","rel":"","context":"In &quot;Spring AI&quot;","block_context":{"text":"Spring AI","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_ai\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/compliance-5899194_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/compliance-5899194_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/compliance-5899194_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/compliance-5899194_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/compliance-5899194_1280-jpg.avif 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/comments?post=3145"}],"version-history":[{"count":1,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3145\/revisions"}],"predecessor-version":[{"id":3147,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3145\/revisions\/3147"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media\/3146"}],"wp:attachment":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media?parent=3145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/categories?post=3145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/tags?post=3145"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/series?post=3145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}