Example usage for java.lang Class getModifiers

List of usage examples for java.lang Class getModifiers

Introduction

In this page you can find the example usage for java.lang Class getModifiers.

Prototype

@HotSpotIntrinsicCandidate
public native int getModifiers();

Source Link

Document

Returns the Java language modifiers for this class or interface, encoded in an integer.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isProtected(modifier)) {
        System.out.println("isProtected");
    }/*from w ww  .j a v a  2  s .  co  m*/
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isStrict(modifier)) {
        System.out.println("isStrict");
    }//from  w w w . j a v  a 2  s .co m
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isStatic(modifier)) {
        System.out.println("isStatic");
    }/*from   w ww . ja  v  a  2s. co m*/
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isPublic(modifier)) {
        System.out.println("isPublic");
    }/*ww w .  j a  va2  s  .com*/
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isSynchronized(modifier)) {
        System.out.println("isSynchronized");
    }//from  w w w.java2s . c o  m
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isInterface(modifier)) {
        System.out.println("isInterface");
    }//from   w w  w.  j ava2s. c om
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isNative(modifier)) {
        System.out.println("isNative");
    }//  ww w .  j  a va2 s  .  co  m
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isTransient(modifier)) {
        System.out.println("isTransient");
    }/*from   ww  w  . j a v a  2  s.  c  o m*/
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isAbstract(modifier)) {
        System.out.println("isAbstract");
    }//w w  w.j a v  a2s .co  m
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class<?> clazz = String.class;
    int modifier = clazz.getModifiers();

    if (Modifier.isVolatile(modifier)) {
        System.out.println("isVolatile");
    }// ww w .  j ava2 s .c o  m
}