How to compare a parameter type with a class
See original GitHub issueHi, I’ve been trying this in many ways but the API is very restrictive:
var paramInfo = methodInfo.getParameterInfo()[0];
if (paramInfo.getTypeDescriptor().equalsIgnoringTypeParams(/* ??? */)) { ... }
What to put in the question marks to know if a parameter is of a specific type?
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Java: Is it possible to compare a Class<?> object with a ...
Java: Is it possible to compare a Class<?> object with a generic type parameter? ... but how can i know if it represents...
Read more >Comparer<T>.Compare(T, T) Method - Microsoft Learn
When overridden in a derived class, performs a comparison of two objects of the same type and returns a value indicating whether one...
Read more >type() and isinstance() in Python with Examples - Guru99
Parameters. object: An object whose instance you are comparing with classtype. It will return true if the type matches otherwise false. class ......
Read more >[class.compare.default]
A comparison operator function for class C that is defaulted on its first declaration and is not defined as deleted is implicitly defined...
Read more >How to Compare Two Objects in Java - Javatpoint
In the Employee class, we have defined two fields regno of type int and name of type String. After that, we have created...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks so much @lukehutch, your documentation is very clear. As you said is more work, so for my use case I think is ok to
loadClass
, and also because is only done once.@xaviarias the
loadClass()
methods do not initialize the class when the class is loaded, so what you’re doing should be pretty fast. However check out the new documentation anyway (see previous comment), it is better to only load classes if you actually need them.