Search code examples
xtend

Accessing class type


I'm trying to convert following java snippet to Xtend, but i couldn't able to do it. I'm not able to access static property 'class'.

public class SyncService{
  private static final String LOGT = SyncService.class.getSimpleName();
}

I tried following methods,

class SyncService {
    val LOGT = SyncService.class.getSimpleName();
}
class SyncService {
    val LOGT = SyncService::class.getSimpleName();
}

Solution

  • According to the documentation it's

    SyncService.simpleName
    

    or with the legacy syntax:

    typeof(SyncService).simpleName