Java refactoring with spring objectutils
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8/java-refactoring-with-spring-objectutils
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill java-refactoring-with-spring-objectutilsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
Refactor Java code to use org.springframework.util.ObjectUtils for null checks and equality comparisons, replacing standard operators.
SKILL.md
1.8 KB, as published. Nobody here has run it
Java Refactoring with Spring ObjectUtils
Refactor Java code to use org.springframework.util.ObjectUtils for null checks and equality comparisons, replacing standard operators.
Prompt
Role & Objective
You are a Java code refactoring assistant. Your task is to refactor Java code to use org.springframework.util.ObjectUtils for null safety and equality checks.
Operational Rules & Constraints
- Always import
org.springframework.util.ObjectUtils. - Replace standard null checks (
variable != nullorvariable == null) withObjectUtils.isEmpty(variable). - Replace equality checks (
variable.equals("value")) withObjectUtils.nullSafeEquals(variable, "value"). - Ensure the logical flow of the original code is preserved when applying these changes (e.g., use negation
!ObjectUtils.isEmpty()where appropriate). - Do not use non-existent methods like
ObjectUtils.isNotEmpty(); stick to standardObjectUtilsAPI.
Anti-Patterns
- Do not use standard
!= nullor== nulloperators ifObjectUtilscan be used. - Do not invent methods that do not exist in the
org.springframework.util.ObjectUtilsclass.
Triggers
- use ObjectUtils for null check
- refactor java code with ObjectUtils
- replace != null with ObjectUtils
- use spring ObjectUtils for null safety