本文整理汇总了Java中sun.reflect.ConstructorAccessor类的典型用法代码示例。如果您正苦于以下问题:Java ConstructorAccessor类的具体用法?Java ConstructorAccessor怎么用?Java ConstructorAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConstructorAccessor类属于sun.reflect包,在下文中一共展示了ConstructorAccessor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getConstructorAccessor
import sun.reflect.ConstructorAccessor; //导入依赖的package包/类
/** @deprecated private API (to be removed in IDEA 17) */
@SuppressWarnings("unused")
public static ConstructorAccessor getConstructorAccessor(@NotNull Constructor constructor) {
if (acquireConstructorAccessorMethod == null || getConstructorAccessorMethod == null) {
throw new IllegalStateException();
}
constructor.setAccessible(true);
try {
acquireConstructorAccessorMethod.invoke(constructor);
return (ConstructorAccessor)getConstructorAccessorMethod.invoke(constructor);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:JetBrains,项目名称:jediterm,代码行数:17,代码来源:ReflectionUtil.java
示例2: acquireConstructorAccessor
import sun.reflect.ConstructorAccessor; //导入依赖的package包/类
private ConstructorAccessor acquireConstructorAccessor() {
// First check to see if one has been created yet, and take it
// if so.
ConstructorAccessor tmp = null;
if (root != null) tmp = root.getConstructorAccessor();
if (tmp != null) {
constructorAccessor = tmp;
} else {
// Otherwise fabricate one and propagate it up to the root
tmp = reflectionFactory.newConstructorAccessor(this);
setConstructorAccessor(tmp);
}
return tmp;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:Constructor.java
示例3: setConstructorAccessor
import sun.reflect.ConstructorAccessor; //导入依赖的package包/类
void setConstructorAccessor(ConstructorAccessor accessor) {
constructorAccessor = accessor;
// Propagate up
if (root != null) {
root.setConstructorAccessor(accessor);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:Constructor.java
示例4: getConstructorAccessor
import sun.reflect.ConstructorAccessor; //导入依赖的package包/类
@NotNull
public static ConstructorAccessor getConstructorAccessor(@NotNull Constructor constructor) {
constructor.setAccessible(true);
// it is faster to invoke constructor via sun.reflect.ConstructorAccessor; it avoids AccessibleObject.checkAccess()
try {
acquireConstructorAccessorMethod.invoke(constructor);
return (ConstructorAccessor)getConstructorAccessorMethod.invoke(constructor);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ReflectionUtil.java
示例5: createInstanceViaConstructorAccessor
import sun.reflect.ConstructorAccessor; //导入依赖的package包/类
@NotNull
public static <T> T createInstanceViaConstructorAccessor(@NotNull ConstructorAccessor constructorAccessor,
@NotNull Object... arguments) {
try {
return (T)constructorAccessor.newInstance(arguments);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ReflectionUtil.java
示例6: makeEnum
import sun.reflect.ConstructorAccessor; //导入依赖的package包/类
public static Object makeEnum(Class<?> enumClass, String name, int ordinal, Class<?>[] paramTypes, Object[] paramValues) throws Exception {
ArrayList<Class<?>> allParamTypes = new ArrayList<Class<?>>();
allParamTypes.add(String.class);
allParamTypes.add(Integer.TYPE);
allParamTypes.addAll(Arrays.asList(paramTypes));
ArrayList<Object> allParamValues = new ArrayList<Object>();
allParamValues.add(name);
allParamValues.add(Integer.valueOf(ordinal));
allParamValues.addAll(Arrays.asList(paramValues));
Constructor<?> enumConstructor = enumClass.getDeclaredConstructor((Class[]) allParamTypes.toArray(new Class[0]));
ConstructorAccessor constructorAccessor = ReflectionFactory.getReflectionFactory().newConstructorAccessor(enumConstructor);
return constructorAccessor.newInstance(allParamValues.toArray(new Object[0]));
}
开发者ID:MCCarbon,项目名称:Carbon-2,代码行数:16,代码来源:DynamicEnumType.java
示例7: getConstructorAccessor
import sun.reflect.ConstructorAccessor; //导入依赖的package包/类
private static ConstructorAccessor getConstructorAccessor(Class<?> enumClass, Class<?>[] additionalParameterTypes)
throws NoSuchMethodException {
Class<?>[] parameterTypes = new Class[additionalParameterTypes.length + 2];
parameterTypes[0] = String.class;
parameterTypes[1] = int.class;
System.arraycopy(additionalParameterTypes, 0, parameterTypes, 2, additionalParameterTypes.length);
return reflectionFactory.newConstructorAccessor(enumClass.getDeclaredConstructor(parameterTypes));
}
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:9,代码来源:ChangeEnumValues.java
示例8: getConstructorAccessor
import sun.reflect.ConstructorAccessor; //导入依赖的package包/类
private static ConstructorAccessor getConstructorAccessor(Class<?> enumClass,
Class<?>[] additionalParameterTypes) throws NoSuchMethodException {
Class<?>[] parameterTypes = new Class[additionalParameterTypes.length + 2];
parameterTypes[0] = String.class;
parameterTypes[1] = int.class;
System.arraycopy(additionalParameterTypes, 0,
parameterTypes, 2, additionalParameterTypes.length);
return ReflectionFactory.getReflectionFactory().newConstructorAccessor(enumClass.getDeclaredConstructor(parameterTypes));
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:ReflectionUtils.java
示例9: acquireConstructorAccessor
import sun.reflect.ConstructorAccessor; //导入依赖的package包/类
private void acquireConstructorAccessor() {
// First check to see if one has been created yet, and take it
// if so.
ConstructorAccessor tmp = null;
if (root != null) tmp = root.getConstructorAccessor();
if (tmp != null) {
constructorAccessor = tmp;
return;
}
// Otherwise fabricate one and propagate it up to the root
tmp = reflectionFactory.newConstructorAccessor(this);
setConstructorAccessor(tmp);
}
开发者ID:jgaltidor,项目名称:VarJ,代码行数:14,代码来源:Constructor.java
示例10: createInstanceViaConstructorAccessor
import sun.reflect.ConstructorAccessor; //导入依赖的package包/类
/** @deprecated private API, use {@link #createInstance(Constructor, Object...)} instead (to be removed in IDEA 17) */
@SuppressWarnings("unused")
public static <T> T createInstanceViaConstructorAccessor(@NotNull ConstructorAccessor constructorAccessor, @NotNull Object... arguments) {
try {
@SuppressWarnings("unchecked") T t = (T)constructorAccessor.newInstance(arguments);
return t;
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:JetBrains,项目名称:jediterm,代码行数:12,代码来源:ReflectionUtil.java
注:本文中的sun.reflect.ConstructorAccessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论