Initial design for the TypeInfo class

This commit is contained in:
Andrey Breslav
2011-05-05 17:07:22 +04:00
parent 0e63fa3761
commit f84bdf0d54
4 changed files with 50 additions and 2 deletions
+10
View File
@@ -0,0 +1,10 @@
package jet;
import jet.typeinfo.TypeInfo;
/**
* @author abreslav
*/
public interface JetObject {
TypeInfo<?> getTypeInfo();
}
+33
View File
@@ -0,0 +1,33 @@
package jet.typeinfo;
import jet.JetObject;
/**
* @author abreslav
*/
public class TypeInfo<T> implements JetObject {
private TypeInfo<?> typeInfo;
private final TypeInfo<?> typeArgument;
private TypeInfo(TypeInfo<?> typeArgument) {
this.typeArgument = typeArgument;
}
public boolean isInstance(Object obj) {
throw new UnsupportedOperationException(); // TODO
}
public boolean isSubtypeOf(TypeInfo<?> other) {
throw new UnsupportedOperationException(); // TODO
}
@Override
public TypeInfo<?> getTypeInfo() {
if (typeInfo == null) {
// TODO: Implementation must be lazy, otherwise the result would be of an infinite size
throw new UnsupportedOperationException(); // TODO
}
return typeInfo;
}
}