All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bbottema.javareflection.model.LookupMode Maven / Gradle / Ivy

package org.bbottema.javareflection.model;

import org.bbottema.javareflection.valueconverter.ValueConversionHelper;

/**
 * Defines lookup modes for matching Java methods and constructors. Each time a lookup failed on signature type, a less strict lookup
 * is performed, in the following order (signature means: the list of parameters defined for a method or constructor):
 * 
    *
  1. exact matching: the given type should exactly match the found types during lookup. This lookup cycle is always performed * first.
  2. *
  3. autobox matching: the given type should match its boxed/unboxed version.
  4. *
  5. polymorphic interface matching: the given type should match one of the implemented interfaces
  6. *
  7. polymorphic superclass matching: the given type should match one of the super classes (for each superclass, the cycle is * repeated, so exact and interface matching come first again before the next superclass up in the chain)
  8. *
  9. common conversion matching: if all other lookups fail, one last resort is to try to convert the given type, if a common * type, to any other common type and then try to find a matching method or constructor. See {@link ValueConversionHelper} for more on the possibilities. *
  10. *
*/ public enum LookupMode { /** * Indicates that looking for methods includes trying to find compatible signatures by autoboxing the specified arguments. */ AUTOBOX, /** * Indicates that looking for methods includes trying to find compatible signatures by casting the specified arguments to a super type. */ CAST_TO_SUPER, /** * Indicates that looking for methods includes trying to find compatible signatures by casting the specified arguments to an implemented * interface. */ CAST_TO_INTERFACE, /** * Indicates that looking for methods includes trying to find compatible signatures by automatically converting the specified arguments. */ COMMON_CONVERT, /** * Like {@link #COMMON_CONVERT}, but now takes the registered converters and continues finding a conversion path based on the previous outcomes. *

* Examples: *

    *
  • Joda date object -> String -> Java8 date object. This would require only the toJava8 date object converter to work
  • *
  • Calendar -> String -> char. Calendar is compatible with String and String with char, but conversion will fail of course.
  • *
  • Boolean -> Character -> long. This simply works out of the box, resulting in 0 or 1.
  • *
*/ SMART_CONVERT }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy