Questions tagged [reflection]
Reflection is the ability of a computer program to examine, introspect, and modify its own structure and behavior at runtime.
56 questions
3
votes
0
answers
117
views
How to implement introspection of user-defined data in my software renderer
I am in the process of writing my own software renderer. I am currently working on setting up a shader system that allows users of the renderer to create their own Vertex Shader and Fragment Shader. ...
1
vote
7
answers
538
views
How do I cleanly keep track of the type of various objects implementing a common interface without reflection?
In my multiplayer game I keep track of each player's inventory. I have a class for each inventory action that extends the abstract class InventoryItem. I then polymorphically call use() on the ...
13
votes
6
answers
10k
views
Why use a special "Name" class (instead of just a string) for representing object names in C++?
Suppose we have an Instance class in a C++ program, which has a GUID/UUID, name, parents, children, and other properties which can be saved to or loaded from an XML file.
The intuitive approach for ...
1
vote
1
answer
114
views
How to show type introspection in UML
I'm modeling a part of Python/Qt GUI code which uses reflection to construct a collection of widgets, in a form. The code works like this:
There is a Model which has attributes of various types, ...
0
votes
1
answer
2k
views
Mapping list to another list dynamically
I had an idea for a piece of software using .NET C# as technology.
Basically, in my idea Im thinking of using reflection to do the mapping between a class to another class using interactivity with a ...
1
vote
1
answer
188
views
Good approaches when one needs to access private variables in production systems
At my company we needed access to some variable to call a method on it, this variable is hidden about 6 layers down of different libraries code and each time it is behind a private variables (that ...
17
votes
4
answers
6k
views
What do IDEs use to do code completion suggestions?
For example if I have a class like
class Foo {
public int bar;
public Foo(int constructor_var) {
bar = construction_var;
}
public bar_plus_one() {
return bar++;
}...
2
votes
2
answers
1k
views
Java: Is reflection bad for AOP situations?
Imagine the following situation:
1. Consume a 3rd party WSDL, out comes thousands of classes.
2. There's an opportunity to optimize performance by using a custom paralleled implementation.
3. Wsdl ...
3
votes
1
answer
2k
views
Alternative to Reflection
I will directly come to our current working flow so that you can understand the problem in a clear picture.
I am attached in Laboratory Automation System in which Analyzer (a machine that performs ...
2
votes
3
answers
4k
views
How to build rest calls dynamically to interface with different APIs?
Lets say I am building an application where clients can book bus tickets. The only thing they do is select, origin, destination and the type of service (express or standard). The system will then book ...
0
votes
1
answer
225
views
Method for loading and running user defined code in .NET windows application
Are there any patterns that address how to have and application load and run user defined code at run-time? I am looking into developing a C# library that the users of a Test Executive application (...
2
votes
3
answers
313
views
Is there a pattern to describe a class that symbolises an instance of an instance of another class?
I am currently working on a project that generates videos from templates (a template being a collection of JSON files and assets).
It seems natural to have a Template class that contains all the info ...
0
votes
1
answer
93
views
Effective ways of dealing with static analyser warnings caused by incidental use of reflection
I don't normally use reflection directly while programming in Java. But I do use APIs and frameworks that internally rely on reflection or annotations to provide customization points.
A lot of ...
1
vote
1
answer
1k
views
Need to call private method in third party library. Copy all class or use reflection?
I need to call a method that is available in a third party library, but it is a private method. There is no direct or indirect way to obtain the same functionality via public methods available.
I ...
1
vote
1
answer
105
views
Is there a simple way to call a method on an object in another program with a given id over TCP?
I'm working on a project where I have two programs which need to invoke methods on some of each other's objects.
I do this by sending JSON objects over a TCP connection. These objects have a ...