/*
- * Copyright 2011 BitMeister Inc.
+ * Copyright 2011-2012 BitMeister Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if (tag != null) {
return tagClass == tag.tagClass() && tagNumber == tag.tagNumber();
}
- @SuppressWarnings("unchecked")
TypeSpecification typeSpec = TypeSpecification
- .getSpecification((Class<? extends ASN1Type>) field.getType());
+ .getSpecification(field.getType().asSubclass(ASN1Type.class));
if (typeSpec.tagged()) {
return typeSpec.matches(tagClass, tagNumber);
}
*
* @return An empty instance of this element type.
*/
- @SuppressWarnings("unchecked")
public ASN1Type instantiate() {
return ASN1Type
- .instantiate((Class<? extends ASN1Type>) field.getType());
+ .instantiate(field.getType().asSubclass(ASN1Type.class));
}
/**
*
* @return The type of this field.
*/
- @SuppressWarnings("unchecked")
Class<? extends ASN1Type> type() {
- return (Class<? extends ASN1Type>) field.getType();
+ return field.getType().asSubclass(ASN1Type.class);
}
/**
*
* @return
*/
- @SuppressWarnings("unchecked")
Class<? extends ASN1Type> enclosingType() {
- return (Class<? extends ASN1Type>) field.getDeclaringClass();
+ return field.getDeclaringClass().asSubclass(ASN1Type.class);
}
/**