本文整理汇总了Java中java.lang.reflect.MalformedParameterizedTypeException类的典型用法代码示例。如果您正苦于以下问题:Java MalformedParameterizedTypeException类的具体用法?Java MalformedParameterizedTypeException怎么用?Java MalformedParameterizedTypeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MalformedParameterizedTypeException类属于java.lang.reflect包,在下文中一共展示了MalformedParameterizedTypeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: throwRandomRuntimeException
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
public static void throwRandomRuntimeException() {
String random = "planb:" + UUID.randomUUID().toString();
RuntimeException[] exceptions = new RuntimeException[]{
new IllegalStateException("This is a test exception because the sate " + random),
new IllegalArgumentException("Wrong argument test exception" + random),
new RuntimeException("This is a test exception " + random),
new IllegalSelectorException(),
new IndexOutOfBoundsException("A test index exception " + random),
new ClassCastException("A test class cast exception " + random),
new NoSuchElementException("A test no such element exception " + random),
new MalformedParameterizedTypeException(),
new BufferOverflowException(),
new EmptyStackException(),
new NullPointerException("This is not a real nullpointer " + random),
new SecurityException("This is not a real security exception " + random),
new ArithmeticException("This is not a real arithmetic exception " + random),
new IllegalThreadStateException("This is a test exception with threads " + random),
new IllegalCharsetNameException("Charset is wrong test exception " + random),
new IllegalMonitorStateException("This is a test exception with illegal monitor " + random)};
throw exceptions[new Random().nextInt(exceptions.length)];
}
示例2: resolve
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
Type resolve()
{
GenericDeclaration d = decl;
while (d != null)
{
for (TypeVariable t : d.getTypeParameters())
{
if (t.getName().equals(name))
{
return t;
}
}
d = getParent(d);
}
throw new MalformedParameterizedTypeException();
}
示例3: getGenericSuperclass
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
public Type getGenericSuperclass() throws GenericSignatureFormatError, TypeNotPresentException, MalformedParameterizedTypeException {
String tmp;
if (isInterface() || ((tmp = getCanonicalName()) != null && tmp.equals("java.lang.Object")) || isPrimitive()) {
return null;
}
if (isArray()) {
return (Type) OBJECT_CLASS;
}
Class<?> clazz = getSuperclass();
if (clazz.getTypeParameters().length == 0) {
return (Type) clazz;
}
return getCache().getGenericSuperclass();
}
示例4: getLowerBounds
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
public Type[] getLowerBounds() throws TypeNotPresentException, MalformedParameterizedTypeException {
if (lowerBounds == null) {
if (wildCardTypeBillet.boundsType == false) {
int l = wildCardTypeBillet.bounds.length;
lowerBounds = new Type[l];
for (int i = 0; i < l; i++) {
// it can be InterimTypeVariable or InterimParameterizedType or InterimClassType.
// The MalformedParameterizedTypeException and TypeNotPresentException should be raised here if it needs.
try {
lowerBounds[i] = AuxiliaryCreator.createTypeArg(wildCardTypeBillet.bounds[i], this.startPoint);
} catch(ClassNotFoundException e) {
throw new TypeNotPresentException(((InterimClassType)wildCardTypeBillet.bounds[i]).classTypeName.substring(1).replace('/', '.'), e); // ClassNotFoundException may appear here only for InterimClassType, see AuxiliaryCreator.createTypeArg.
}
}
} else {
lowerBounds = new Type[0];
}
}
return (Type[])this.lowerBounds.clone();
}
示例5: getUpperBounds
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
public Type[] getUpperBounds() throws TypeNotPresentException, MalformedParameterizedTypeException {
if (upperBounds == null) {
if (wildCardTypeBillet.boundsType) {
int l = wildCardTypeBillet.bounds.length;
upperBounds = new Type[l];
for (int i = 0; i < l; i++) {
// it can be InterimTypeVariable or InterimParameterizedType or InterimClassType.
// The MalformedParameterizedTypeException and TypeNotPresentException should be raised here if it needs.
try {
upperBounds[i] = AuxiliaryCreator.createTypeArg(wildCardTypeBillet.bounds[i], this.startPoint);
} catch(ClassNotFoundException e) {
throw new TypeNotPresentException(((InterimClassType)wildCardTypeBillet.bounds[i]).classTypeName.substring(1).replace('/', '.'), e); // ClassNotFoundException may appear here only for InterimClassType, see AuxiliaryCreator.createTypeArg.
}
}
} else {
upperBounds = new Type[1];
upperBounds[0] = (Type) Object.class;
}
}
return (Type[])this.upperBounds.clone();
}
示例6: ParameterizedTypeImpl
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
public ParameterizedTypeImpl(Class<?> rawType, Type ownerType, Type[] actualTypeArguments) {
this.rawType = rawType;
this.ownerType = ownerType == null ? rawType.getDeclaringClass() : ownerType;
this.actualTypeArguments = actualTypeArguments;
TypeVariable<?>[] formals = rawType.getTypeParameters();
if (formals.length != actualTypeArguments.length) {
throw new MalformedParameterizedTypeException();
}
}
示例7: validateConstructorArguments
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
private void validateConstructorArguments() {
TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
// check correct arity of actual type args
if (formals.length != actualTypeArguments.length){
throw new MalformedParameterizedTypeException();
}
for (int i = 0; i < actualTypeArguments.length; i++) {
// check actuals against formals' bounds
}
}
示例8: validateConstructorArguments
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
private void validateConstructorArguments() {
TypeVariable<?>[] formals = rawType.getTypeParameters();
// check correct arity of actual type args
if (formals.length != actualTypeArguments.length){
throw new MalformedParameterizedTypeException();
}
for (int i = 0; i < actualTypeArguments.length; i++) {
// check actuals against formals' bounds
}
}
示例9: validateConstructorArguments
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
private void validateConstructorArguments() {
TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
// check correct arity of actual type args
if (formals.length != actualTypeArguments.length) {
throw new MalformedParameterizedTypeException();
}
/*
for (int i = 0; i < actualTypeArguments.length; i++) {
// check actuals against formals' bounds
}
*/
}
示例10: validateConstructorArguments
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
private void validateConstructorArguments() {
TypeVariable/* <?> */[] formals = rawType.getTypeParameters();
// check correct arity of actual type args
if (formals.length != actualTypeArguments.length) {
throw new MalformedParameterizedTypeException();
}
for (int i = 0; i < actualTypeArguments.length; i++) {
// check actuals against formals' bounds
}
}
示例11: ParameterizedTypeImpl
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
private ParameterizedTypeImpl(Class<?> rawType, Type[] actualTypeArguments) {
this.actualTypeArguments = actualTypeArguments;
this.rawType = rawType;
ownerType = rawType.getDeclaringClass();
TypeVariable<?>[] formals = rawType.getTypeParameters();
if (formals.length != actualTypeArguments.length) {
throw new MalformedParameterizedTypeException();
}
}
示例12: test_Constructor
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
/**
* java.lang.reflect.MalformedParameterizedTypeException#MalformedParameterizedTypeException()
*/
public void test_Constructor() throws Exception {
Constructor<MalformedParameterizedTypeException> ctor = MalformedParameterizedTypeException.class
.getDeclaredConstructor();
assertNotNull("Parameterless constructor does not exist.", ctor);
assertTrue("Constructor is not protected", Modifier.isPublic(ctor
.getModifiers()));
assertNotNull(ctor.newInstance());
}
示例13: validateConstructorArguments
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
private void validateConstructorArguments() {
@SuppressWarnings("rawtypes")
TypeVariable[] arrayOfTypeVariable=this.rawType.getTypeParameters();
if(arrayOfTypeVariable.length != this.actualTypeArguments.length) {
throw new MalformedParameterizedTypeException();
}
// for(int i=0; i < this.actualTypeArguments.length; i++);
}
示例14: validateConstructorArguments
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
private void validateConstructorArguments() {
TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
// check correct arity of actual type args
if (formals.length != actualTypeArguments.length) {
throw new MalformedParameterizedTypeException();
}
for (int i = 0; i < actualTypeArguments.length; i++) {
// check actuals against formals' bounds
}
}
示例15: test_Constructor
import java.lang.reflect.MalformedParameterizedTypeException; //导入依赖的package包/类
/**
* @tests java.lang.reflect.MalformedParameterizedTypeException#MalformedParameterizedTypeException()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Since this constructor is never invoked, this test only verifies its existence.",
method = "MalformedParameterizedTypeException",
args = {}
)
public void test_Constructor() throws Exception {
Constructor<MalformedParameterizedTypeException> ctor = MalformedParameterizedTypeException.class
.getDeclaredConstructor();
assertNotNull("Parameterless constructor does not exist.", ctor);
assertTrue("Constructor is not protected", Modifier.isPublic(ctor
.getModifiers()));
assertNotNull(ctor.newInstance());
}