本文整理了Java中java.lang.reflect.Constructor.toGenericString()
方法的一些代码示例,展示了Constructor.toGenericString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Constructor.toGenericString()
方法的具体详情如下:
包路径:java.lang.reflect.Constructor
类名称:Constructor
方法名:toGenericString
[英]Returns the string representation of the constructor's declaration, including the type parameters.
[中]返回构造函数声明的字符串表示形式,包括类型参数。
代码示例来源:origin: spring-projects/spring-loaded
public static String callToGenericString(Constructor thiz) {
return thiz.toGenericString();
}
代码示例来源:origin: aws/aws-sdk-java
public static <T> T newInstance(Class<T> clazz, Object... params) {
Constructor<T> constructor = findConstructor(clazz, params);
try {
return constructor.newInstance(params);
} catch (InstantiationException ex) {
throw new IllegalStateException(
"Could not invoke " + constructor.toGenericString(),
ex);
} catch (IllegalAccessException ex) {
throw new IllegalStateException(
"Could not invoke " + constructor.toGenericString(),
ex);
} catch (InvocationTargetException ex) {
if (ex.getCause() instanceof RuntimeException) {
throw (RuntimeException) ex.getCause();
}
throw new IllegalStateException(
"Unexpected checked exception thrown from "
+ constructor.toGenericString(),
ex);
}
}
代码示例来源:origin: cucumber/cucumber-jvm
public <T> T newInstance(Class[] constructorParams, Object[] constructorArgs, Class<? extends T> clazz) {
Constructor<? extends T> constructor = null;
try {
constructor = clazz.getConstructor(constructorParams);
try {
return constructor.newInstance(constructorArgs);
} catch (Exception e) {
String message = String.format("Failed to instantiate %s with %s", constructor.toGenericString(), Arrays.asList(constructorArgs));
throw new CucumberException(message, e);
}
} catch (NoSuchMethodException e) {
throw new CucumberException(e);
}
}
代码示例来源:origin: jersey/jersey
@Override
public void visitResourceHandlerConstructor(final HandlerConstructor constructor) {
Class<?> resClass = constructor.getConstructor().getDeclaringClass();
boolean isSingleton = isSingleton(resClass);
int paramCount = 0;
for (Parameter p : constructor.getParameters()) {
ResourceMethodValidator.validateParameter(p, constructor.getConstructor(), constructor.getConstructor()
.toGenericString(),
Integer.toString(++paramCount), isSingleton);
}
}
代码示例来源:origin: jersey/jersey
@Override
public void visitResourceHandlerConstructor(final HandlerConstructor constructor) {
Class<?> resClass = constructor.getConstructor().getDeclaringClass();
boolean isSingleton = isSingleton(resClass);
int paramCount = 0;
for (Parameter p : constructor.getParameters()) {
ResourceMethodValidator.validateParameter(p, constructor.getConstructor(), constructor.getConstructor()
.toGenericString(),
Integer.toString(++paramCount), isSingleton);
}
}
代码示例来源:origin: jersey/jersey
selectedSize, maxParams, clazz.getName(), selected.toGenericString()));
代码示例来源:origin: jersey/jersey
selectedSize, maxParams, clazz.getName(), selected.toGenericString()));
代码示例来源:origin: jersey/jersey
selectedSize, maxParams, clazz.getName(), selected.toGenericString()));
代码示例来源:origin: com.alibaba/fastjson
+ beanInfo.creatorConstructor.toGenericString(), e);
} catch (Exception e) {
throw new JSONException("create instance error, "
+ beanInfo.creatorConstructor.toGenericString(), e);
代码示例来源:origin: azkaban/azkaban
logger.info("Constructor found " + con.toGenericString());
obj = con.newInstance(jobName, props);
} else if (getConstructor(runningClass, String.class, Properties.class) != null) {
logger.info("Constructor found " + con.toGenericString());
obj = con.newInstance(jobName, properties);
} else if (getConstructor(runningClass, String.class, Map.class) != null) {
final Constructor<?> con =
getConstructor(runningClass, String.class, Map.class);
logger.info("Constructor found " + con.toGenericString());
} else if (getConstructor(runningClass, String.class) != null) {
final Constructor<?> con = getConstructor(runningClass, String.class);
logger.info("Constructor found " + con.toGenericString());
obj = con.newInstance(jobName);
} else if (getConstructor(runningClass) != null) {
final Constructor<?> con = getConstructor(runningClass);
logger.info("Constructor found " + con.toGenericString());
obj = con.newInstance();
} else {
logger.error("Constructor not found. Listing available Constructors.");
for (final Constructor<?> c : runningClass.getConstructors()) {
logger.info(c.toGenericString());
代码示例来源:origin: com.alibaba/fastjson
+ beanInfo.creatorConstructor.toGenericString(), e);
代码示例来源:origin: org.glassfish.jersey.core/jersey-server
@Override
public void visitResourceHandlerConstructor(final HandlerConstructor constructor) {
Class<?> resClass = constructor.getConstructor().getDeclaringClass();
boolean isSingleton = isSingleton(resClass);
int paramCount = 0;
for (Parameter p : constructor.getParameters()) {
ResourceMethodValidator.validateParameter(p, constructor.getConstructor(), constructor.getConstructor()
.toGenericString(),
Integer.toString(++paramCount), isSingleton);
}
}
代码示例来源:origin: EvoSuite/evosuite
@Override
public String toString() {
return constructor.toGenericString();
}
代码示例来源:origin: aadnk/ProtocolLib
@Override
public String toGenericString() {
return constructor.toGenericString();
}
@Override
代码示例来源:origin: org.patterntesting/patterntesting-rt
/**
* To long string.
*
* @return the string
* @see org.aspectj.lang.Signature#toLongString()
*/
@Override
public String toLongString() {
return this.ctor.toGenericString();
}
代码示例来源:origin: apache/attic-polygene-java
private String createExceptionMessage( Object[] parametersInstance )
{
return "Could not instantiate " + NL + " " + constructor.getDeclaringClass()
+ NL + "using constructor:" + NL + " " + constructor.toGenericString()
+ NL + "parameter types:" + NL + " " + Arrays.toString( parametersInstance );
}
代码示例来源:origin: jmockit/jmockit1
@SuppressWarnings("DynamicRegexReplaceableByCompiledPattern")
private void printCandidateConstructorNameIfRequested(@Nonnull Constructor<?> candidate) {
if (searchResults != null) {
String constructorDesc = candidate.toGenericString().replace("java.lang.", "").replace(",", ", ");
searchResults.append("\r\n ").append(constructorDesc).append("\r\n");
}
}
代码示例来源:origin: airlift/drift
@Override
protected void validateConstructors()
{
for (ConstructorInjection constructorInjection : constructorInjections) {
if (constructorInjection.getParameters().size() > 1) {
metadataErrors.addError(
"@ThriftConstructor [%s] takes %d arguments, this is illegal for an union",
constructorInjection.getConstructor().toGenericString(),
constructorInjection.getParameters().size());
}
}
}
代码示例来源:origin: com.facebook.swift/swift-codec
@Override
protected void validateConstructors()
{
for (ConstructorInjection constructorInjection : constructorInjections) {
if (constructorInjection.getParameters().size() > 1) {
metadataErrors.addError("@ThriftConstructor [%s] takes %d arguments, this is illegal for an union",
constructorInjection.getConstructor().toGenericString(),
constructorInjection.getParameters().size());
}
}
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
@Override
public void visitResourceHandlerConstructor(final HandlerConstructor constructor) {
Class<?> resClass = constructor.getConstructor().getDeclaringClass();
boolean isSingleton = isSingleton(resClass);
int paramCount = 0;
for (Parameter p : constructor.getParameters()) {
ResourceMethodValidator.validateParameter(p, constructor.getConstructor(), constructor.getConstructor()
.toGenericString(),
Integer.toString(++paramCount), isSingleton);
}
}
内容来源于网络,如有侵权,请联系作者删除!