Unable to fully check type argument for Java class instance

40 views
Skip to first unread message

Mohammad Als

unread,
Feb 19, 2019, 9:23:30 AM2/19/19
to ceylon-users
I'm trying to use Ceylon meta model to for determining type of member objects of Java class instance at runtime and then storing the type in a java.util.Set.

value type = `Customers`;

The Customers type is determined as "org.jooq::TableField<db.jooq.metadata.gen.tables.records::CustomersRecord,java.lang::String>" through the below code:

for(attr in type.getDeclaredAttributes<Customers>()) {
if(attr.declaration.name == fieldName){
print("has type: ``attr.type``");
assert(is TableField<CustomersRecord, JString> attributeType = attr.type);
//x.add(attributeType);
//aMap.put(attributeType, fieldValue);
}
}

Now I try to narrow down the type received using assert statement and that's where it fails.
Exception in thread "main" ceylon.language.AssertionError "Assertion failed
	violated is TableField<CustomersRecord, JString> attributeType = attr.type
		expression has type com.redhat.ceylon.compiler.java.runtime.metamodel.meta::InterfaceImpl<org.jooq::TableField<db.jooq.metadata.gen.tables.records::CustomersRecord,java.lang::String>> which is not a subtype of org.jooq::TableField<db.jooq.metadata.gen.tables.records::CustomersRecord,java.lang::String>"

 
Is there a way to achieve this?
Reply all
Reply to author
Forward
0 new messages