当前位置: 首页>>代码示例>>Java>>正文


Java MalformedParameterizedTypeException类代码示例

本文整理汇总了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)];
}
 
开发者ID:patrickfav,项目名称:planb-android,代码行数:23,代码来源:DemoAppUtil.java

示例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();
}
 
开发者ID:vilie,项目名称:javify,代码行数:17,代码来源:GenericSignatureParser.java

示例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();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:Class.java

示例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();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:WildcardTypeImpl.java

示例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();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:WildcardTypeImpl.java

示例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();
  }
}
 
开发者ID:XDean,项目名称:Java-EX,代码行数:11,代码来源:ParameterizedTypeImpl.java

示例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
    }

}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:12,代码来源:ParameterizedTypeImpl.java

示例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
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:ParameterizedTypeImpl.java

示例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
        }
*/
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:ParameterizedTypeImpl.java

示例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
    }

}
 
开发者ID:blusechen,项目名称:venus,代码行数:12,代码来源:ParameterizedTypeImpl.java

示例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();
	}
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:11,代码来源:ParameterizedTypeUtils.java

示例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());
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:12,代码来源:MalformedParameterizedTypeExceptionTests.java

示例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++);
}
 
开发者ID:qiujiayu,项目名称:AutoLoadCache,代码行数:10,代码来源:ParameterizedTypeImpl.java

示例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
    }

}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:12,代码来源:ParameterizedTypeImpl.java

示例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());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:18,代码来源:MalformedParameterizedTypeExceptionTests.java


注:本文中的java.lang.reflect.MalformedParameterizedTypeException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。