/**
  * Method called to create a "default instance" of the bean, currently only needed for obtaining
  * default field values which may be used for suppressing serialization of fields that have "not
  * changed".
  *
  * @param fixAccess If true, method is allowed to fix access to the default constructor (to be
  *     able to call non-public constructor); if false, has to use constructor as is.
  * @return Instance of class represented by this descriptor, if suitable default constructor was
  *     found; null otherwise.
  */
 public Object instantiateBean(boolean fixAccess) {
   AnnotatedConstructor ac = _classInfo.getDefaultConstructor();
   if (ac == null) {
     return null;
   }
   if (fixAccess) {
     ac.fixAccess();
   }
   try {
     return ac.getAnnotated().newInstance();
   } catch (Exception e) {
     Throwable t = e;
     while (t.getCause() != null) {
       t = t.getCause();
     }
     if (t instanceof Error) throw (Error) t;
     if (t instanceof RuntimeException) throw (RuntimeException) t;
     throw new IllegalArgumentException(
         "Failed to instantiate bean of type "
             + _classInfo.getAnnotated().getName()
             + ": ("
             + t.getClass().getName()
             + ") "
             + t.getMessage(),
         t);
   }
 }
 public List<AnnotatedMethod> getFactoryMethods() {
   // must filter out anything that clearly is not a factory method
   List<AnnotatedMethod> candidates = _classInfo.getStaticMethods();
   if (candidates.isEmpty()) {
     return candidates;
   }
   ArrayList<AnnotatedMethod> result = new ArrayList<AnnotatedMethod>();
   for (AnnotatedMethod am : candidates) {
     if (isFactoryMethod(am)) {
       result.add(am);
     }
   }
   return result;
 }
 /**
  * Method that can be called to find if introspected class declares a static "valueOf" factory
  * method that returns an instance of introspected type, given one of acceptable types.
  *
  * @param expArgTypes Types that the matching single argument factory method can take: will also
  *     accept super types of these types (ie. arg just has to be assignable from expArgType)
  */
 public Method findFactoryMethod(Class<?>... expArgTypes) {
   // So, of all single-arg static methods:
   for (AnnotatedMethod am : _classInfo.getStaticMethods()) {
     if (isFactoryMethod(am)) {
       // And must take one of expected arg types (or supertype)
       Class<?> actualArgType = am.getParameterClass(0);
       for (Class<?> expArgType : expArgTypes) {
         // And one that matches what we would pass in
         if (actualArgType.isAssignableFrom(expArgType)) {
           return am.getAnnotated();
         }
       }
     }
   }
   return null;
 }
 /**
  * Method that can be called to locate a single-arg constructor that takes specified exact type
  * (will not accept supertype constructors)
  *
  * @param argTypes Type(s) of the argument that we are looking for
  */
 public Constructor<?> findSingleArgConstructor(Class<?>... argTypes) {
   for (AnnotatedConstructor ac : _classInfo.getConstructors()) {
     // This list is already filtered to only include accessible
     /* (note: for now this is a redundant check; but in future
      * that may change; thus leaving here for now)
      */
     if (ac.getParameterCount() == 1) {
       Class<?> actArg = ac.getParameterClass(0);
       for (Class<?> expArg : argTypes) {
         if (expArg == actArg) {
           return ac.getAnnotated();
         }
       }
     }
   }
   return null;
 }
 public AnnotatedMethod findMethod(String name, Class<?>[] paramTypes) {
   return _classInfo.findMethod(name, paramTypes);
 }
 public List<AnnotatedConstructor> getConstructors() {
   return _classInfo.getConstructors();
 }
 /**
  * Method that will locate the no-arg constructor for this class, if it has one, and that
  * constructor has not been marked as ignorable.
  *
  * @since 1.9
  */
 @Override
 public AnnotatedConstructor findDefaultConstructor() {
   return _classInfo.getDefaultConstructor();
 }
 @Override
 public Annotations getClassAnnotations() {
   return _classInfo.getAnnotations();
 }
 /**
  * Method for checking whether class being described has any annotations recognized by registered
  * annotation introspector.
  */
 @Override
 public boolean hasKnownClassAnnotations() {
   return _classInfo.hasAnnotations();
 }