aboutsummaryrefslogtreecommitdiff
path: root/src/jdk/internal/dynalink/beans/BeansLinker.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jdk/internal/dynalink/beans/BeansLinker.java')
-rw-r--r--src/jdk/internal/dynalink/beans/BeansLinker.java44
1 files changed, 32 insertions, 12 deletions
diff --git a/src/jdk/internal/dynalink/beans/BeansLinker.java b/src/jdk/internal/dynalink/beans/BeansLinker.java
index e0c14b0d..439c5a65 100644
--- a/src/jdk/internal/dynalink/beans/BeansLinker.java
+++ b/src/jdk/internal/dynalink/beans/BeansLinker.java
@@ -131,7 +131,7 @@ import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
public class BeansLinker implements GuardingDynamicLinker {
private static final ClassValue<TypeBasedGuardingDynamicLinker> linkers = new ClassValue<TypeBasedGuardingDynamicLinker>() {
@Override
- protected TypeBasedGuardingDynamicLinker computeValue(Class<?> clazz) {
+ protected TypeBasedGuardingDynamicLinker computeValue(final Class<?> clazz) {
// If ClassValue.put() were public, we could just pre-populate with these known mappings...
return
clazz == Class.class ? new ClassLinker() :
@@ -154,7 +154,7 @@ public class BeansLinker implements GuardingDynamicLinker {
* @param clazz the class
* @return a bean linker for that class
*/
- public static TypeBasedGuardingDynamicLinker getLinkerForClass(Class<?> clazz) {
+ public static TypeBasedGuardingDynamicLinker getLinkerForClass(final Class<?> clazz) {
return linkers.get(clazz);
}
@@ -169,12 +169,32 @@ public class BeansLinker implements GuardingDynamicLinker {
}
/**
+ * Returns true if the object is a Dynalink Java constructor.
+ *
+ * @param obj the object we want to test for being a constructor
+ * @return true if it is a constructor, false otherwise.
+ */
+ public static boolean isDynamicConstructor(final Object obj) {
+ return obj instanceof DynamicMethod && ((DynamicMethod)obj).isConstructor();
+ }
+
+ /**
+ * Return the dynamic method of constructor of the given class and the given signature.
+ * @param clazz the class
+ * @param signature full signature of the constructor
+ * @return DynamicMethod for the constructor
+ */
+ public static Object getConstructorMethod(final Class<?> clazz, final String signature) {
+ return StaticClassLinker.getConstructorMethod(clazz, signature);
+ }
+
+ /**
* Returns a collection of names of all readable instance properties of a class.
* @param clazz the class
* @return a collection of names of all readable instance properties of a class.
*/
- public static Collection<String> getReadableInstancePropertyNames(Class<?> clazz) {
- TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
+ public static Collection<String> getReadableInstancePropertyNames(final Class<?> clazz) {
+ final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
if(linker instanceof BeanLinker) {
return ((BeanLinker)linker).getReadablePropertyNames();
}
@@ -186,8 +206,8 @@ public class BeansLinker implements GuardingDynamicLinker {
* @param clazz the class
* @return a collection of names of all writable instance properties of a class.
*/
- public static Collection<String> getWritableInstancePropertyNames(Class<?> clazz) {
- TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
+ public static Collection<String> getWritableInstancePropertyNames(final Class<?> clazz) {
+ final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
if(linker instanceof BeanLinker) {
return ((BeanLinker)linker).getWritablePropertyNames();
}
@@ -199,8 +219,8 @@ public class BeansLinker implements GuardingDynamicLinker {
* @param clazz the class
* @return a collection of names of all instance methods of a class.
*/
- public static Collection<String> getInstanceMethodNames(Class<?> clazz) {
- TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
+ public static Collection<String> getInstanceMethodNames(final Class<?> clazz) {
+ final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
if(linker instanceof BeanLinker) {
return ((BeanLinker)linker).getMethodNames();
}
@@ -212,7 +232,7 @@ public class BeansLinker implements GuardingDynamicLinker {
* @param clazz the class
* @return a collection of names of all readable static properties of a class.
*/
- public static Collection<String> getReadableStaticPropertyNames(Class<?> clazz) {
+ public static Collection<String> getReadableStaticPropertyNames(final Class<?> clazz) {
return StaticClassLinker.getReadableStaticPropertyNames(clazz);
}
@@ -221,7 +241,7 @@ public class BeansLinker implements GuardingDynamicLinker {
* @param clazz the class
* @return a collection of names of all writable static properties of a class.
*/
- public static Collection<String> getWritableStaticPropertyNames(Class<?> clazz) {
+ public static Collection<String> getWritableStaticPropertyNames(final Class<?> clazz) {
return StaticClassLinker.getWritableStaticPropertyNames(clazz);
}
@@ -230,12 +250,12 @@ public class BeansLinker implements GuardingDynamicLinker {
* @param clazz the class
* @return a collection of names of all static methods of a class.
*/
- public static Collection<String> getStaticMethodNames(Class<?> clazz) {
+ public static Collection<String> getStaticMethodNames(final Class<?> clazz) {
return StaticClassLinker.getStaticMethodNames(clazz);
}
@Override
- public GuardedInvocation getGuardedInvocation(LinkRequest request, final LinkerServices linkerServices)
+ public GuardedInvocation getGuardedInvocation(final LinkRequest request, final LinkerServices linkerServices)
throws Exception {
final CallSiteDescriptor callSiteDescriptor = request.getCallSiteDescriptor();
final int l = callSiteDescriptor.getNameTokenCount();