Skip to content

Instantly share code, notes, and snippets.

@TheKodeToad
Created October 10, 2024 22:37
Show Gist options
  • Save TheKodeToad/223ff914d68f146c7ae07d1d0d91a7ca to your computer and use it in GitHub Desktop.
Save TheKodeToad/223ff914d68f146c7ae07d1d0d91a7ca to your computer and use it in GitHub Desktop.
Java class name generator
const CLASS_SEGMENTS = [
"Abstract",
"Builder",
"Factory",
"Supplier",
"Consumer",
"Delegate",
"Bean",
"I",
"Enum",
"Base",
"Auto",
"Internal",
"External",
"Message",
"Component",
"Attribute",
"Element",
"User",
"Entity",
"Command",
"Data",
"Object",
"Config",
"Manager",
"Printer",
"Writer",
"Reader",
"Generator",
"Eater",
"Drinker",
"Slurper",
"Parser",
"Runnable",
"Executable",
];
function generateJavaClassName() {
let result = "";
let components = 2 + Math.floor(Math.random() * 11);
while (components > 0) {
result += CLASS_SEGMENTS[Math.floor(Math.random() * CLASS_SEGMENTS.length)];
--components;
}
return "public class " + result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment