Most voted "reflection" questions
Reflection is the process by which a program can observe and modify its own structure and behavior at runtime. Commonly used to view metadata, associate methods and properties, and discover types.
Learn more…124 questions
Sort by count of
-
0
votes0
answers32
viewsHow to check if my table has related records?
I am developing a project using JPA and with various relationship types like Onetomany, Manytomany, etc. Is there any way I can check if an X table for example has related records in another Y table…
-
0
votes1
answer242
viewsCheck if a variable exists in a class
People I am trying to verify if a variable exists in a class. For this I am using the code: try{ clazz.getDeclaredField("id"); } catch(Exception e){ System.out.println(e.getMessage()); } With that I…
-
0
votes1
answer36
viewsUsing java.lang.reflect.Parameter in android applications
Hello. I’m trying to implement an android application (with the Android Studio IDE) that uses Reflections to access certain attributes of a class. However, when using the class…
-
0
votes2
answers148
viewsIs it possible to extend a class via java Reflection?
I work with an API that changes the class name and package name whenever a major update comes out, however, I am required to support older versions of the API and for that I use Reflections in these…
-
0
votes1
answer27
viewsReflection c# WPF Observablecollection
I have a problem, when creating an Observablecollection I do so: ObservableCollection<MinhaClasse> Lista = new ObservableCollection<MinhaClasse>(); So far so good. My problem is, through…
-
0
votes1
answer557
viewsRTTI Free on an object created by Invoke
I’m creating a routine to instantiate a class via RTTI and validate whether this class implements a interface. I have a test class implemented as follows: unit teste.classeTeste.uclasseTeste;…
-
0
votes1
answer215
viewsProblem calling method from a newly loaded class
I made a code that dynamically compiles a java file, and through . class generated can load this class, create an instance and invoke its methods using the method getDeclaredMethod(). So far so…
-
0
votes0
answers47
viewsAbout packages via Reflection x Manually
Well, the title may not have been very explanatory, but I hope to improve on the content of the topic. I made a library in C# in which to date, manually writes packages, as in the example below:…
-
0
votes1
answer139
viewsError when obtaining value of a property through reflection
I’m having trouble with the following line of code: var key = entity.GetType().GetProperties().FirstOrDefault(p => p.Name.ToLower().Contains("id")).GetValue(this, null); Every time he gets on…
-
0
votes0
answers305
viewsInstantiating Object dynamically
Good morning, I need to instantiate a class according to the parameter received by a webhook, someone has some idea how to do? It would be more or less that (some scenarios): Client I receive JSON…
-
0
votes1
answer93
viewsSort by Reflection with Getproperty
I have a generic class with a method that needs to sort a generic object. However, give error saying that does not recognize the Reflection Getproperty method, because lambda can not translate. How…
c# asp.net-mvc entity-framework classification reflectionasked 7 years, 5 months ago LeoFelipe 1,455 -
0
votes1
answer68
viewsChecks if a class has a @interface
I have the class below as an example: package br.com.nomeMarca.testes; import br.com.nomeMarca.cidog.interfaces.*; import javafx.beans.property.*; import java.io.*; import java.math.*; import…
-
0
votes1
answer52
viewsResponse and Request format
We have an Endpoint in Rest for access to a partner’s data, also in Rest. (We use Springboot) Their answer is in Portuguese. According to our client’s policy, all our Endpoint code and interface…
-
0
votes0
answers55
viewsHow to get a variable name?
Is there any way to get the name of a variable using metaprogramming (or reflection, I believe) in Ruby? I want something like nameof of the C#. I was looking for something like: minha_variavel =…
-
0
votes2
answers98
viewsReflect java caching, how to do?
If I can instantiate a new object with Reflection, how can I caching for the type it belongs to? newInstance() returns a type Object but I need the primary object, which I can get the guy by name.…
-
0
votes1
answer551
viewsHow to use a variable that represents the name of a label to change its value?
I created a method to form a Name that there is any Label of the program, and give a numerical value to the property Text of that Label graduate. And I just need to be able to do it like this:…
-
0
votes1
answer107
viewsGetvalue() does not show value that is assigned to the variable
static void Main(string[] args) { // ASSIM FUNCIONA //var ObjGeneric = new Pessoa(); //ObjGeneric.Nome = "PAULO TADEU CHAGAS"; //ObjGeneric.Idade = 25; //…
-
0
votes1
answer202
viewsDynamically referencing dll C#
During the development of an application that will connect to a database of different versions, a question arose whether it is possible to load the dll based on the version selected by the user.…
-
0
votes1
answer77
viewsHow to create a custom annotation in Spring Boot and run it automatically when a method is called?
I would like to create my own annotations. For example; when a controller spring is called and it has my annotation, some validation is executed. @GetMapping @MinhaAnotacao(value="log") // Aqui…
-
-1
votes1
answer92
viewsHow to set the values of a Propertyinfo of the instantiated classes within a class?
I am doing a generic method for rounding values of a class(T), but I also have the classes within this principal(T), these classes I can set in this way: IEnumerable<PropertyInfo>…
-
-1
votes1
answer64
viewsProblems with cast in Reflection
Good afternoon. I’m new to using the java Reflection API. I’m having the following problem, when trying to create a generic Dao class to be used in a CRUD for sqlite on android, I can’t cast a field…
-
-1
votes1
answer50
viewsJava reflection value checker
I’m trying to use Reflection and Recursion to capture values. For example: public class Endereco{ String rua; Integer numero; } public class Cachorro{ String nome; Integer idade; } public class…
-
-2
votes1
answer64
viewsHow to get a specific field of a class even though it is inherited
I am facing problems while trying to get a field of a class, I am always getting the error NoSuchFieldException. What is known is that this field is inherited and deprived of another class, but the…
-
-4
votes0
answers16
viewsName of the variable in looping
I need to display the name of the variable in which it contains the value that is inside the range... in case the variable name 'value2'. Is there a way to find the name of this variable for display…