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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:14:17+00:00 2026-05-13T15:14:17+00:00

Ladies & Gentlemen, I´m new to Java, forgive me if it´s obvious, but I

  • 0

Ladies & Gentlemen,

I´m new to Java, forgive me if it´s obvious, but I haven´t found much about it.

I´d like to create dynamic properties (variables) for a class at runtime (define an object that can be altered at runtime by adding or changing properties and methods).


Reason: I want to store a data model in GAE that can be extended dynamically after compilation of the app (yes, the DataStore allows that). What properties should be added are stored in the DataStore as well (It´s like using Robots to built Robots…funny).

Python allows me to add properties at Runtime. Groovy seems to allow that, too. The only thing in the “pure” Java world indicating in that direction seems to be “Dynamic Proxies”.

But I couldn´t figure out yet if they do the trick.

  • 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-05-13T15:14:17+00:00Added an answer on May 13, 2026 at 3:14 pm

    Java doesn’t have the capability to dynamically add properties. Nor does it have the ability to dynamically create classes at runtime or change them at runtime. Java is strongly and statically typed. The best you can do is put such properties into a Map or similar.

    Edit: Ok, apparently some clarifications are in order. The OP specifically mentioned GAE, which none of these methods will work on but I’ll mention them since some seem to take exception to their absence.

    The Java Compiler API (Java 6+) allows you to compile Java classes at runtime. Technically you could write out a Java source file to look exactly how you want, compile it and load it.

    Java bytecode libraries can rewrite classes at runtime. This is used by such libraries as JPA (and others). You could modify classes this way.

    What the OP is referring to however is a) in reference to working on GAE and b) more in the order of how Javascript allows you to modify classes or particular instances at runtime by dynamically adding, removing or change properties. Java certainly doesn’t do this and specifically doesn’t on the GAE.

    The above is not an exception to this just like casting a class to char * in C++ so you can read private members doesn’t mean C++ doesn’t have private members. You’re essentially bypassing the Java runtime with both of these methods even though they’re part of Java.

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

Sidebar

Related Questions

Ladies & Gentlemen, Short Version: Trying to dynamically create a Spine Model Class. Basically
Good evening ladies and gentlemen, I have a problem with Java Swing that I
Ladies and gentlemen, I am working hard on a new webapplication which is based
Ladies, gentlemen. I was reading Google's documentation for Closure Templates. There's not that much
Ladies and Gentlemen, Using javascript, how do I access 'id' in a JSON string
Ladies and Gentlemen, For quite a long time now, I've been using the following
Good evening ladies and gentlemen! Searching for a cross-browser solution to embed commercial fonts
Good Evening Stackoverflow Lords & Ladies, I am attempting to develop a Layar layer
Ladies and gents, I found a very strange behavior which I cannot explain: Assume
Gentlemen and esteemed ladies. I posted this question in the COM forum at Code

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.