Entity Fields & CollectionNames

Generates enums for raw field names and collections that preserve the raw field names in Mongo entities.


Entity identification

The default webfluxDocumentName is org.springframework.data.mongodb.core.mapping.Document from Spring Data MongoDB. It processes classes with that annotation under the entityPackage.

Creation example

MemberEntityFields.java
java
/**
 * Generated by script, do not edit manually
 * @see com.example.entity.MemberEntity
 */
public enum MemberEntityFields {
  id("_id"),
  accountName("account_name"),
  createdAt("createdAt");

  private final String rawName;

  MemberEntityFields(String rawName) {
    this.rawName = rawName;
  }

  public String getRawName() {
    return rawName;
  }

  @Override
  public String toString() {
    return rawName;
  }
}

Exploring raw field names

The Java field name is the default, and it reads the value or name of Spring Data @Field, relational/JPA @Column, and Jackson @JsonProperty as strings. Java keywords, names starting with numbers, and special characters are converted to safe enum identifiers while keeping the rawName.

EntityFileWatcher.Config

rootPath

default src/main/java

entityPackage

entity source package

fieldPackage

{Entity}Fields output package

collectionNamePackage

CollectionNames output package

collectionNameEnum

default CollectionNames

webfluxDocumentName

entity identification annotation FQN

Do not modify generated files directly

© 2026 Byeolnaerim. All rights reserved.IntroductionPrivacy Policy