Palani
Palani

Reputation: 9032

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();
}

Upvotes: 3

Views: 744

Answers (1)

Sebastian Zarnekow
Sebastian Zarnekow

Reputation: 6729

According to the documentation it's

SyncService.simpleName

or with the legacy syntax:

typeof(SyncService).simpleName

Upvotes: 3

Related Questions