简体   繁体   English

Oxygene中Java表达式“Class.class”的等价物是什么?

[英]What is the equivalent of the Java expression “Class.class” in Oxygene?

In some Java source for Android I see expressions involving a "class" member on Class types, for example when constructing a ComponentName object: 在Android的一些Java源代码中,我看到涉及Class类型的“类”成员的表达式,例如在构造ComponentName对象时:

cname := new ComponentName( this, SomeClass.class );

This does not compile in Oxygene for Java, with the compiler claiming that there is no such static member 'class' on the type. 这不能在Oxygene for Java中编译,编译器声称该类型上没有这样的静态成员“class”。

What is the equivalent Oxygene syntax ? 什么是等效的Oxygene语法?

The "class" member of a Class type in Java is not part of the Java object model but is interpreted directly by the Java compiler. Java中Class类的“class”成员不是Java对象模型的一部分,而是由Java编译器直接解释。 What is sometimes called "compiler magic". 什么有时被称为“编译魔术”。

The equivalent compiler magic in Oxygene is the typeof() built-in function: Oxygene中等效的编译器魔法是typeof()内置函数:

cname := new ComponentName( self, typeof(SomeClass) );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM