Questions tagged [dynamic-class]

45 questions
7
votes
1 answer

Multiple paamayim nekudotayims in PHP, why not?

In PHP 5.3.6, I've noticed that the following won't work: class Foo{ public static $class = 'Bar'; } class Bar{ public static function sayHello(){ echo 'Hello World'; } } Foo::$class::sayHello(); Issuing an unexpected…
Dan Lugg
  • 20,192
  • 19
  • 110
  • 174
6
votes
4 answers

Create Class dynamically at runtime

I have a method like this: (this is a generic method, and DYNAMIC_CLASS_TYPE will be changed in situation to other situation) Dim res = f.MyMethod(Of DYNAMIC_CLASS_TYPE)("select Id, Name from myTable") I want to create a dynamic class, based on my…
Vahid Farahmandian
  • 6,081
  • 7
  • 42
  • 62
5
votes
2 answers

Vue.js dynamic classes

I have some html using Vue.js here: I have the javascript here: var…
user10768351
5
votes
1 answer

Byte Buddy - define constructor with call to super class and initialize field

I have a class such as: public class Sample{ private String a; private String b; public Sample(String a, String b) { this.a = a; this.b = b; } public String getA() {return a;} public String getB() {return b;} } I want to create a…
Rotem ben
  • 156
  • 2
  • 13
5
votes
3 answers

Generating Dynamic Class Java

I am generating a dynamic class in my java program by writing all my code into a java file, compiling the java file into a class file and then loading the class file with a URLClassLoader. The problem with this is that it creates a lot of files on…
Josh Sobel
  • 1,268
  • 3
  • 14
  • 27
4
votes
2 answers

Instantiate a class from a string in ActionScript 3

I've got a string which, in run-time, contains the name of a class that I want to instantiate. How would I do that? I read suggestions to use flash.utils.getDefinitionByName(): var myClass:Class = getDefinitionByName("package.className") as…
Andy
  • 95
  • 1
  • 7
4
votes
3 answers

Pickling of dynamic class definition

I am trying to pickle a dynamically generated class as a factory for an alternative class. Something like the following: import sys, pickle class BC(object): pass C = type("NewClassName", (BC,), {}) pickle.dump(C, sys.stdout) This leads to…
eatdas
  • 149
  • 13
3
votes
1 answer

Debug a dynamically created class in Visual Studio & C#

My project uses a library which in turn uses Microsoft.Practices.Unity to dynamically create a class and run some of its methods. This class is throwing an error after it is created. Is it possible for me to use the Visual Studio debugger to step…
Jeff
  • 13,943
  • 11
  • 55
  • 103
3
votes
0 answers

An asset packaging tool for plain old java (like Android's R class)

I was impressed by the way android creates an R class during development. I do my development in Android Studio (which basically is a tuned IntelliJ version). Whenever I add a resource, in a matter of seconds the R class is updated with new…
bvdb
  • 22,839
  • 10
  • 110
  • 123
3
votes
4 answers

Create a dynamic class in java

I'm working on a problem where different animal types implement the same talk() method from Animal interface. If you look at getAnimal() method, you can see that, when a new kind of animal is added to the program, inside of that method has to be…
user_01
  • 447
  • 3
  • 9
  • 16
3
votes
1 answer

PHP namespace and dynamic classname

I've encountered a "weird" thing while experimenting with spl_autoload, namespaces and dynamic class names. I use PHP 5.3.2, call the autoload like…
user1482915
  • 33
  • 1
  • 4
2
votes
2 answers

In Flex, how do I know when the properties of a dynamic object change?

I have a dynamic class that serves as a storage container for configuration settings. The settings are variables of that class and it has methods to read from and write to a configuration file, database etc. Now I want to trigger writing to the…
Hanno Fietz
  • 30,799
  • 47
  • 148
  • 234
2
votes
4 answers

What frameworks/languages support run-time class creation?

I'm trying to put together a list of frameworks/languages support run-time class creation. For example in .NET you can use the System.Reflection.Emit library to emit new classes at run time. If you could mention other frameworks/languages that…
1
vote
3 answers

Referencing embedded assemblies from dynamically created classes

I have been using the technique of embedding dlls (embedded resource) into an exe and using the following code to resolve the unknown dlls at runtime. AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => { String resourceName =…
Schotime
  • 15,707
  • 10
  • 46
  • 75
1
vote
0 answers

How do I assign integer or string values to dynamic classes in python

I have a code in python which looks something like this: def Make_My_Class(): My_Class = type("My_Class", (object, ), { "__init__": Callinit, "My_Funct": Call_My_Funct, }) def Callinit(self): self.value=0 def…
nonsqu
  • 25
  • 2
1
2 3