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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:45:08+00:00 2026-06-13T03:45:08+00:00

In PHP , which is, of course, an interpreted language, I can dereference field

  • 0

In PHP, which is, of course, an interpreted language, I can dereference field names at runtime, e.g. 'source' and 'value' below, and use the values of those two fields pointed to by source and value.

{$key['source']}[LANGUAGE_NONE][0]['value'];

Is there a similar facility in Java to do so? I have some properties of a bean that I need to validate and perform various checks against. Rather than hardcoding the logic, I’d like to loop through a SQL table of fieldnames and perform the indicated validation on the field. E.g. if I have the value "email" in the database, I would pick the property below and validate it based on the rules in the database column:

String email;

I will have many beans and many fields, which is why I was thinking of this approach. I don’t have a say in the design 🙁

Another option I was thinking was using Spring validation, but there does not appear to be a way to trigger it until a Spring Form Bean is submitted. Maybe there’s an alternate way to trigger it?

  • 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-13T03:45:10+00:00Added an answer on June 13, 2026 at 3:45 am

    I think you are saying that you wish to store the names of properties in a data store, and access that data store at runtime to query the properties. The construct you have described is closest to a Map in Java – a key/value pair, and there is nothing to stop you accessing data stored that way, e.g. myMap.get("myproperty");. The problem is modelling all your Objects as Maps isn’t very OO.

    Another option is to use reflection and convention. So a property in your database named ‘source’ would be accessed by a method called ‘getSource()’. This is similar to JavaBeans

    Is that what you meant?

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

Sidebar

Related Questions

Language: PHP I have a form which asks users for their educational details, course
I have a variable called $value in php which has a string value. When
Below is a simple example of my PHP code which (I hope so) is
I'm trying to create a php file which I can edit straight away without
I have this welcome.php which the administrator is redirected when he is authenticated, i
I have a ecrtst.php which has 3 fields for input, on submit - submit-ecr.php.
I have an index.php file which has 2 included files require(stats.php); require(stats_encry.php); stats.php which
I have a PHP script (news-generator.php) which, when I include it, grabs a bunch
I have a php script (generator.php) which generates certain HTML/XML/SVG depending on various conditions.
How do I create dynamic images using php which depend of $_GET['x'] variables?

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.