Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8366018

Beans.instantiate needs to describe the lookup procedure

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P3 P3
    • 26
    • client-libs
    • None
    • minimal
    • Doc only
    • Java API
    • SE

      Summary

      Update the spec. of java.beans.Beans.instantiate() methods to describe the lookup process.

      Problem

      The overload of Beans.instantiate() that described the lookup process was removed in JDK 26. It is now not described anywhere.

      Solution

      Restore the text - in a slightly updated form - to the remaining overloads.

      Specification

      java.beans.Beans : public static Object instantiate(ClassLoader cls, String beanName) throws IOException, ClassNotFoundException

      +     * The bean is created based on a name relative to a class-loader.
      +     * This name should be a dot-separated name such as "a.b.c".
      +     * <p>
      +     * The given name can indicate either a serialized object or a class.
      +     * We first try to treat the beanName as a serialized object
      +     * name then as a class name.
      +     * <p>
      +     * When using the beanName as a serialized object name we convert the
      +     * given beanName to a resource pathname and add a trailing ".ser" suffix.
      +     * We then try to load a serialized object from that resource.
      +     * <p>
      +     * For example, given a beanName of "x.y", Beans.instantiate would first
      +     * try to read a serialized object from the resource "x/y.ser" and if
      +     * that failed it would try to load the class "x.y" and create an
      +     * instance of that class.
      +     *

      public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws IOException, ClassNotFoundException

      +     * The bean is created based on a name relative to a class-loader.
      +     * This name should be a dot-separated name such as "a.b.c".
      +     * <p>
      +     * The given name can indicate either a serialized object or a class.
      +     * We first try to treat the beanName as a serialized object
      +     * name then as a class name.
      +     * <p>
      +     * When using the beanName as a serialized object name we convert the
      +     * given beanName to a resource pathname and add a trailing ".ser" suffix.
      +     * We then try to load a serialized object from that resource.
      +     * <p>
      +     * For example, given a beanName of "x.y", Beans.instantiate would first
      +     * try to read a serialized object from the resource "x/y.ser" and if
      +     * that failed it would try to load the class "x.y" and create an
      +     * instance of that class.
      +     *
      

            prr Philip Race
            hnassour Hamza Nassour
            Sergey Bylokhov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: