Questions tagged [dynamic-class-creation]

Some Object Oriented programming languages allow creating new classes (types) in run-time (as compared to classes defined in the source code and created in compilation time)

Some examples of creating types in run-time:
C#
C++
Java
Python

78 questions
0
votes
2 answers

Adding items into tableview without using an instance of any class

I'm designing a project about cataloging something. In this project user must be able to create his own table as he wish. Therefore I do not have any static class and instance of it. I'm creating a diaglog pane and I can create textfields for user…
Emre SERBEST
  • 115
  • 1
  • 1
  • 8
0
votes
1 answer

Kivy: Attribute error when dynamically adding screen widget

I am trying to create in instance of ProjectScreen dynamic class when add_project_screen is called. I want to create various instances of ProjectScreen, each with a different name, which is obtained from project_name_text_input. Here are my .py and…
0
votes
1 answer

How to store class definition of dynamically generated java class using ASM?

I extended a class dynamically using ASM. I used defineClass method without ProtectionDomain argument.When I try to use that class in other class, I am getting java.lang.NoClassDefFound Error. How can I store or retrieve class definition which is…
0
votes
0 answers

How to create dynamic method in android with the received method string from server

I want to create a dynamic class or method. The server sends the complete class as the response. I want to use the response to create a dynamic class.
0
votes
1 answer

Dynamically creating classes with specific CodeAttributeDeclarations

I have a need to have custom code attributes that output something like "DataType(DataType.Text)" I'm currently attempting to use CodeAttributeDeclarations. But, something like this adds extra parenthesis: var cad = new…
0
votes
1 answer

ES6, React - how to set class name in dynamically generated class?

I have a builder method which wraps a class with injected props and I would like to set class name the same as the wrapped class. how do I achieve this? (just ignore the flow typing if you want) const buildComponentWithInjectedProps = …
jeff
  • 1,169
  • 1
  • 19
  • 44
0
votes
3 answers

Create a List from XElements Dynamically

I am reading a bunch of XML files into a list (IEnumerable really) of XElements. Then I want to convert the XElement list (these XElements contain a bunch of child-elements) into a list of classes, so I can do later operations with the data more…
Sach
  • 10,091
  • 8
  • 47
  • 84
0
votes
1 answer

Dynamic Class has no effect - Ellipse

I am starting out with kivy and I have already hit a roadblock that I cannot solve. All I want is to create a dynamic Ellipse class in kv file and then project that on the canvas of a widget. What I see is that it is recognized as an Ellipse, but…
Nebelhom
  • 3,783
  • 4
  • 21
  • 22
0
votes
2 answers

Iterating a list of dictionaries and converting to objects in Python

Let's say I have a list of dictionaries like: list_of_dicts = [ {'id': 'something', type: 'type_a', blah...}, {'id': 'anotherthing', type: 'type_b', blah...}, {'id': 'yetanotherthing', type: 'type_c', blah...}, etc. ] And I have…
user1087973
  • 800
  • 3
  • 12
  • 29
0
votes
1 answer

Viewmodel attribute 'links' cannot find the model type

While trying to execute the following code on show() we get an exception that the links attribute cannot find the model either if it is specified by class or if it is specified by entityName. Ext.define('myapp.view.film.FilmsViewController',…
George Pligoropoulos
  • 2,919
  • 3
  • 33
  • 65
0
votes
0 answers

Unable to call newInstance() on dynamically generated class

I am starting to use asm for generating classes at runtime. I started with a very simple class, which has just one String field and a getter for the same. ClassWriter cw = new ClassWriter(0); String Name = "Sample"; …
Sachin C Nambiar
  • 135
  • 2
  • 11
0
votes
2 answers

Dynamic class based on string parameter

I have this: public class Blah { public int id { get; set; } public string blahh { get; set; } } public class Doh { public int id { get; set; } public string dohh { get; set; } public…
Tomo
  • 429
  • 1
  • 10
  • 24
0
votes
2 answers

URLClassLoader ClassNotFoundException

I'm trying to write a code that loads classes dynamically at run time public class URLDynClassLoader { public URLDynClassLoader(){ try{ loadclasses( new File("C:/Users/Miller/Desktop/test/") , "Shapes." ); } …
0
votes
1 answer

Python __new__ without calling another class's version of __new__?

What is an example of using __new__ in Python such that within the body of __new__ you do not return the result of calling some other (base, meta, or otherwise) class's version of __new__, but you do return an allocated instance of the intended…
ely
  • 74,674
  • 34
  • 147
  • 228
0
votes
0 answers

ClassNotFoundException when loading a class at runtime

Using the Bukkit-API I'm currently trying to create a plugin which can compile java code of a given pastebin link at runtime and execute that code. Everything is working so far except for one thing: I'm getting a ClassNotFoundException when I'm…