About 5,410,000 results
Open links in new tab
  1. java - What is reflection and why is it useful? - Stack Overflow

    Sep 1, 2008 · What is reflection, and why is it useful? I'm particularly interested in Java, but I assume the principles are the same in any language.

  2. reflection - How do I invoke a Java method when given the …

    You should use reflection - init a class object, then a method in this class, and then invoke this method on an object with optional parameters. Remember to wrap the following snippet in try …

  3. Java reflection: how to get field value from an object, not knowing …

    Mar 7, 2017 · Say, I have a method that returns a custom List with some objects. They are returned as Object to me. I need to get value of a certain field from these objects, but I don't …

  4. Change private static final field using Java reflection

    Jul 21, 2010 · I have a class with a private static final field that, unfortunately, I need to change it at run-time. Using reflection I get this error: java.lang.IllegalAccessException: Can not set …

  5. Java reflection - access protected field - Stack Overflow

    Dec 6, 2013 · How can I access an inherited protected field from an object by reflection?

  6. java - How do I access private methods and private data members …

    27 I know that we can access private constructor via reflection as @Sanjay T. Sharma mentioned in his answer of my question: Does “instanceof Void” always return false? However, @duffymo …

  7. I want to use reflection in Java 17 for all JRE ... - Stack Overflow

    Jul 20, 2023 · I could assemble a very long list of --add-opens flags, but I was hoping there was a cleaner way to allow reflection to all JRE classes. My code needs to use reflection for many …

  8. Java introspection and reflection - Stack Overflow

    Jan 11, 2010 · Reflection (taken from oracle java tutorial) Reflection is commonly used by programs which require the ability to examine or modify the runtime behavior of applications …

  9. java - Any way to Invoke a private method? - Stack Overflow

    May 19, 2009 · I have a class that uses XML and reflection to return Object s to another class. Normally these objects are sub fields of an external object, but occasionally it's something I …

  10. java - Using reflection to set an object property - Stack Overflow

    Jan 17, 2013 · 89 Instead of trying to call a setter, you could also just directly set the value to the property using reflection. For example: