src/java.base/share/classes/jdk/internal/access/JavaBeansAccess.java
author mchung
Tue, 06 Nov 2018 10:01:16 -0800
changeset 52427 3c6aa484536c
parent 47216 src/java.base/share/classes/jdk/internal/misc/JavaBeansAccess.java@71c04702a3d5
permissions -rw-r--r--
8211122: Reduce the number of internal classes made accessible to jdk.unsupported Reviewed-by: alanb, dfuchs, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23581
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
     1
/*
52427
3c6aa484536c 8211122: Reduce the number of internal classes made accessible to jdk.unsupported
mchung
parents: 47216
diff changeset
     2
 * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
23581
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
     4
 *
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    10
 *
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    15
 * accompanied this code).
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    16
 *
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    20
 *
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    23
 * questions.
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    24
 */
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    25
52427
3c6aa484536c 8211122: Reduce the number of internal classes made accessible to jdk.unsupported
mchung
parents: 47216
diff changeset
    26
package jdk.internal.access;
23581
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    27
30906
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    28
import java.lang.reflect.Constructor;
23581
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    29
import java.lang.reflect.Method;
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    30
30906
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    31
public interface JavaBeansAccess {
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    32
    /**
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    33
     * Returns the getter method for a property of the given name
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    34
     * @param clazz The JavaBeans class
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    35
     * @param property The property name
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    36
     * @return The resolved property getter method
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    37
     * @throws Exception
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    38
     */
23581
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    39
    Method getReadMethod(Class<?> clazz, String property) throws Exception;
30906
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    40
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    41
    /**
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    42
     * Return the <b>value</b> attribute of the associated
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    43
     * <code>@ConstructorProperties</code> annotation if that is present.
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    44
     * @param ctr The constructor to extract the annotation value from
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    45
     * @return The {@code value} attribute of the <code>@ConstructorProperties</code>
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    46
     *         annotation or {@code null} if the constructor is not annotated by
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    47
     *         this annotation or the annotation is not accessible.
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    48
     */
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    49
    String[] getConstructorPropertiesValue(Constructor<?> ctr);
23581
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents:
diff changeset
    50
}