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 8360773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:32:50+00:00 2026-06-09T11:32:50+00:00

I have an enum FooBar at class Clazz with falues FOO and BAR like

  • 0

I have an enum FooBar at class Clazz with falues FOO and BAR like this:

class Clazz {
    enum FooBar{
        FOO,
        BAR
    }
}

I now would like to use wicket getString() method to localize the values FOO and BAR. The best I can do is to define at i18n file

 Clazz.FooBar.FOO=foo
 Clazz.FooBar.BAR=bar

and I get values with this code

 fooBar = FooBar.FOO;
 getString("Clazz.FooBar." + fooBar.name());

I have heard that this could be achieved without Clazz.FooBar addition to the i18n query string, but the method to be called would be different. How to do this?

  • 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-09T11:32:52+00:00Added an answer on June 9, 2026 at 11:32 am

    You can put this method in your base page/panel:

    public String getString(Enum<?> value) {
        Class<?> enclosingClass = value.getClass().getEnclosingClass();
        String key = (enclosingClass == null ? "" : enclosingClass.getSimpleName() + ".")
                + value.getClass().getSimpleName() + "." + value.name();
        return getString(key);
    }
    

    Then you can simply call it with

    getString(Clazz.FooBar.FOO);
    

    and it will return what you defined in the property file.

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

Sidebar

Related Questions

I have an enum that looks like this: enum foo{ a=0, b=1, c=2, d=4
If I have an C++ enum: enum Foo { Bar, Baz, Bork, }; How
I have enum like this [Flags] public enum Key { None = 0, A
I have enum like this: public enum ObectTypes { TypeOne, TypeTwo, TypeThree, ... TypeTwenty
I have an enum class called Gender , and I have values in this
Let's say I have this class: public class SiteMapEntry { public static enum ChangeFrequency
I have an enum in a namespace and I'd like to use it as
I have enum like this public enum PetType { Dog = 1, Cat =
I have enum like this public enum Sizes { Normal(232), Large(455); private final int
I have this enum (class) enum class conditional_operator { plus_op, or_op, not_op } And

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.