Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9182653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:36:39+00:00 2026-06-17T18:36:39+00:00

I have some jxpaths I want to put them in an enumeration I will

  • 0

I have some jxpaths I want to put them in an enumeration I will be sharing with a JSF page using a map that will make them available to EL as the keys for jxpath to do a createPathAndSetValue on.

Then I can easily fill out a model without creating tons of getters and setters.
like this:

<h:inputText value="#{backingBeanMap[backingBeanMap.billingAddress_postalCode]}" />

I have something like this

public enum MWField {
    isGiftJoin,
    billingAddress_postalCode,
    ...
    associates$3_memberInfo_membershipType_type;

    public final String xpath;

    MWField(){
        this.xpath = name().replace('_', '/').replace("$0", "[0]")
        .replace("$1", "[1]").replace("$2", "[2]")
        .replace("$3", "[3]").replace("$4", "[4]")
        .replace("$5", "[5]").replace("$6", "[6]")
        .replace("$7", "[7]").replace("$6", "[6]")
        .replace("$9", "[9]").replace("$10", "[10]");
    }
}

I use the name isGiftJoin or billingAddress_postalCode instead of uppercase names and do substitution of the _ with / in the constructor (so the xpath attribute is the actual xpath). So long as none of the properties have _ in the name (they don’t), I am done. The enumerations won’t be “UPPERCASE”, but enumerations aren’t really CONSTANTS in the sense that RED is a constant. Here they are instances of a class that point at data, and aren’t intended to be “constant” in that way.

Are these names too wierd and non-standard? Is it silly to be chained to the C style constant UPPERCASE standard?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:36:40+00:00Added an answer on June 17, 2026 at 6:36 pm

    Are you asking if you may name an enum whatever you want?

    Of course; why not? Use a standard that works for you. Personally, I reserve all caps only for static finals, and tends towards class naming conventions for enum values.

    I’m not a huge fan of underscores in names, but in your case, since you’re deliberately creating a hierarchical structure, I have less of an issue with it.

    I would wonder if an enum is really necessary for naming paths: do you need to use them in switch statements (in JDK 6 or less)? Is there a reason to represent them as anything other than strings? Are the names without the paths valuable?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some arbitrary pixel data that I want to save as a PNG.
I have some code that will change the background color of a specific label
Have some div elements on a page that I need to hide by default
Have some data in a sybase image type column that I want to use
I have some tables here, and using this javascript below, I made them hide
We have some feature branches that can get put on ice for a few
Have some nested objects that I'd like serialize using JSON. The problem is that
Have some JavaScript that assigns values to an object using $.data and then uses
I have some large ASCII images that I want to check are symmetrical. Say
I have some high quality recorded sounds that I want to use within a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.