78 questions
0
votes
0
answers
2k
views
Alternative to using--add-opens java.base/java.lang=ALL-UNNAMED
I am trying to create Dynamic classes in Java 17 spring boot application using Javasssist library and this works only when we add VM option as --add-opens java.base/java.lang=ALL-UNNAMED in the spring ...
1
vote
0
answers
47
views
C# EF core create dynamic dbSet and FirstorDefault
I need to find all FK keys. I have a code:
public static List<string> GetAllRelations<T>(DbContext db, T entity) where T : class
{
var model = db.Model;
var userEntity =...
0
votes
1
answer
1k
views
How can I convert an OpenAPIv3/swagger spec into a proxy around an API using Python and Prance library?
I'm building an automatic proxy generator around any arbitrary API given it's swagger document. The intended output would be a python module that could be used as a client for said API. The API itself ...
0
votes
1
answer
44
views
[Vue warn]: Error in render: "TypeError: _vm.stepProgression is not a function"
I'm creating a stepper component with a v-for loop, which currently works without an issues:
<li
v-for="(step, index) in stepper"
:key="step.id"
class="goals-...
4
votes
2
answers
463
views
Reflection to avoid class load
I was reading through the PerfMark code and saw a comment about avoid an accidental class load through using reflection in a commit:
if (Boolean.getBoolean("io.perfmark.PerfMark.debug")) {
- ...
0
votes
0
answers
41
views
Dynamically extend `__del__` cleanup code on an instance
I want to bind a dynamically created namedtuple to a class
When an instance of the class is initialized, a new namedtuple-type is created, and registered in globals() (this allows pickling).
When ...
0
votes
2
answers
1k
views
OData Queries on Entities with Dynamic Fields
I am using OData on a dynamic model. The MyObject data is stored in two different ways on the database - in a main MyObject table and in a secondary table of key/value pairs. The allowed field names ...
0
votes
0
answers
207
views
Python change the scope of classes dynamically created with type() function
I have a factory class with a method that generates classes dynamically.
This class is within a factory.py file.
class Factory:
def __init__(self, ast):
self.ast = ast
self.classes ...
0
votes
0
answers
314
views
Dynamically create a class inherited from neomodel.StructuredNode
Python's library neomodel provides the ability to define a relationship with a class that hasn't been defined yet, by using its name as string, which works fine as follows:
from neomodel import ...
0
votes
2
answers
96
views
Dynamic Class Creation python with metaclass involved
i am trying to create an instance of a class using arguments, and the problem is my meta class needs some positional args to decide about the bases of class creation.
here is an example to clear it ...
1
vote
1
answer
374
views
When is the __prepare__ method of a metaclass excuted and what uses its return value?
PEP 3115 has the following example of using the __prepare__ method of a metaclass (print statements are mine):
# The custom dictionary
class member_table(dict):
def __init__(self):
self....
1
vote
0
answers
386
views
How to generate a POJO class(kotlin/java) programmatically with variables based on REST API response?
I need to generate a data class at run time based on my REST API response with the given class name , and need to access it .Here is the sample json response and expected sample data class .
1) Sample ...
2
votes
1
answer
127
views
Targeting Dynamic Div
I am having trouble targeting a specific div on click, currently when I click "currentTarget.id" the function returns all of the div objects within my JSON file instead of the one that was ...
0
votes
1
answer
1k
views
ByteBuddy intercepting constructor arguments
I am trying to dynamically create a class using ByteBuddy with my custom constructor.
I have read the Intercepting default constructor with Byte Buddy and I have written the following code base on ...
1
vote
2
answers
1k
views
Unable to use dynamic classes with concurrent.futures.ProcessPoolExecutor
In the code below, I am dynamically creating an object of the class inside the _py attribute by using the generate_object method.
The code works perfectly if I am not using a concurrent approach. ...
1
vote
0
answers
203
views
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,
})
...
1
vote
1
answer
390
views
How to supply runtime generated groovy classes to Spring Boot context configuration process
I am generating classes from Groovy source and store them in GroovyClassLoader. These classes have @Configuration annotation.
They are in package a.b.c.d.e.
I want them to configure my spring context. ...
2
votes
0
answers
365
views
Dynamic class generation at runtime in the JVM
I need to take input at runtime and create a new class with it, and load it into the JVM to run.
Although this can quickly become an abstract question with minimal concrete answers, and therefore ...
0
votes
1
answer
62
views
Segmentation Fault with Dynamic Class (homework problem)
I'm attempting to convert a working static String class to a dynamic String class using pointers, but when I implement the pointer it throws a segmentation fault error. Code below:
mystring1.h:
//...
-1
votes
1
answer
571
views
C# create class with conditional operator [duplicate]
I know maybe this not a good way to create class but I just wondered why if else working but conditional
operator not and need implicit conversion
static void Main(string[] args)
{
...
1
vote
2
answers
127
views
What is the difference between class syntax and type()?
I am well aware of fact that classes can be declared dynamically in python using type and have used it here and there. But I am still unclear what are the differences between these two functions.
def ...
2
votes
1
answer
285
views
exec vs type when dynamically creating class in Python
I have a luigi pipeline. We have a lot and lots of external files that change with a regular basis, and we want to be able to build the pipeline from metadata.
I create classes dynamically, and have ...
0
votes
1
answer
53
views
Dynamic Class Load file is not updating on server
When I changed something in a file containing a dynamic class who's name is called from database. its working fine for the local server, but it is not updating on the live server until I change the ...
1
vote
2
answers
15k
views
How to create a class from a Dictionary in C#? [duplicate]
I have written a method which creates a Dictionary. I need to convert this dictionary to a class.
Example of Dictionary
Dictionary<string, dynamic> myDictionary = new Dictionary<string, ...
2
votes
0
answers
256
views
Dynamically create a class that implements arbitrary interfaces
I'm creating a PHP library to extract schema.org structured data out of web pages.
Schema.org features a multiple inheritance hierarchy that I can only achieve through PHP interfaces:
interface ...
0
votes
2
answers
138
views
Why ths php dynamic object class creation is not working?
I am trying to create a class (working as factory class) in my Zend Expressive APP as follows:
declare(strict_types=1);
namespace App\Install\Factory;
use App\Install\Model as Models;
use App\...
2
votes
1
answer
3k
views
Python set attributes during object creation in __new__
When using __new__ to customize the creation of a metaclass, we can pass attributes to the type().__new__ method which will be set on the object before it is returned, e.g.
class Foo(type):
...
0
votes
2
answers
1k
views
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 ...
0
votes
1
answer
1k
views
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 ...
-1
votes
1
answer
130
views
log and track proxy creation in JVM
I have a class-loading problem in my app. We are using custom classloader and all is closed correctly but dynamic classes (com.sun.proxy.* and org.springframework.core.$Proxy) are generated pretty ...
0
votes
1
answer
284
views
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 ...
2
votes
2
answers
2k
views
How to Create Java class/es files dynamically?
I need a way to run a java method for ex. createModule("Login")
and as an output to have:
New folder named mod_login
Inside on mod_login java classes files created from a template
If the template is
...
3
votes
1
answer
183
views
python: name mangling in a dynamically created class
I want to do something like this
def make_class(name : str)->type:
class Ret:
__name__ = name
def __init__(self):
self.__x = 0
return Ret
A = make_class('A')
a = ...
4
votes
1
answer
6k
views
Creating dynamic class from a string containing the class definition
I have a stored procedure which accepts the table name, then it reads the table structure and returns me the table structure in the form of a class definition in a string.
E.g.:
string myString =
"...
0
votes
0
answers
326
views
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
80
views
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 ...
6
votes
1
answer
3k
views
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 ...
0
votes
1
answer
506
views
ES6, React - how to set class name in dynamically generated class? [duplicate]
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)
...
4
votes
1
answer
1k
views
How is the __class__ cell value set in class methods?
Looking at the documentation of the super type in Python 3.5, it notes that super(…) is the same as super(__class__, «first argument to function»). To my surprise, I wrote a method that returned ...
0
votes
3
answers
2k
views
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 ...
0
votes
1
answer
51
views
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 ...
14
votes
2
answers
10k
views
Creating Dynamic Classes in Jade/Pug
I'm trying to add a dynamic class to a jade template. Like so:
- var obj = {a: 1, b: 2, c: 3};
- var len = Object.keys(obj).length;
.abc-#{len}
But the compiler is taking exception to this:
> ...
0
votes
2
answers
265
views
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', ...
0
votes
1
answer
794
views
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....
0
votes
0
answers
78
views
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 ...
4
votes
3
answers
6k
views
Java way to create an object based on enum type
My class is like this:
class X {}
class Y extends X {};
class Z extends X {};
I have an enum for each subclass (id + class):
enum Type {
Y_TYPE(1, Y.class), Z_TYPE(2, Z.class);
int id;
...
2
votes
1
answer
2k
views
super class not assignable to class implemented during runtime by asm
I have a java class that consist of an inner interface, and plan to implement the implementation class during runtime with asm bytecode injection.
package my.example;
public class X{
public ...
0
votes
2
answers
159
views
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; }
...
2
votes
3
answers
2k
views
Using Java Reflection to determine which class to instantiate
There is a Message superclass and there are various Message subclasses like WeddingMessage, GreetingMessage, FarewellMessage, Birthday Message.
The Message superclass has a constructor:
public ...
0
votes
2
answers
2k
views
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/...