The OpenD Programming Language

isFinal

Detect whether X is a final method or class.

template isFinal () {
static if(is(X == class))
enum isFinal;
static if(!(is(X == class)))
static if(isFunction!X)
enum isFinal;
static if(!(is(X == class)))
static if(!(isFunction!X))
enum isFinal;
}

Return Value

true if X is final, false otherwise

Examples

class C
{
    void nf() {}
    static void sf() {}
    final void ff() {}
}
final class FC { }

static assert(!isFinal!(C));
static assert( isFinal!(FC));

static assert(!isFinal!(C.nf));
static assert(!isFinal!(C.sf));
static assert( isFinal!(C.ff));

Meta