Example usage for java.lang.reflect Modifier isStrict

List of usage examples for java.lang.reflect Modifier isStrict

Introduction

In this page you can find the example usage for java.lang.reflect Modifier isStrict.

Prototype

public static boolean isStrict(int mod) 

Source Link

Document

Return true if the integer argument includes the strictfp modifier, false otherwise.

Usage

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 ww  .  ja v a2  s .  c  o m
}

From source file:DeclarationInfoDemo.java

public static void printModifiers(final Class dataType) {
    final int modifiers = dataType.getModifiers();
    if (Modifier.isPrivate(modifiers)) {
        System.out.print("private ");
    }//from ww w.ja  va2s  .  co m
    if (Modifier.isPrivate(modifiers)) {
        System.out.print("private ");
    }
    if (Modifier.isPublic(modifiers)) {
        System.out.print("private ");
    }
    if (Modifier.isAbstract(modifiers)) {
        System.out.print("abstract ");
    }
    if (Modifier.isFinal(modifiers)) {
        System.out.print("final ");
    }
    if (Modifier.isNative(modifiers)) {
        System.out.print("native ");
    }
    if (Modifier.isInterface(modifiers)) {
        System.out.print("interface ");
    }
    if (Modifier.isStatic(modifiers)) {
        System.out.print("static ");
    }
    if (Modifier.isStrict(modifiers)) {
        System.out.print("strict ");
    }
    if (Modifier.isSynchronized(modifiers)) {
        System.out.print("synchronized ");
    }
    if (Modifier.isTransient(modifiers)) {
        System.out.print("transient ");
    }
    if (Modifier.isVolatile(modifiers)) {
        System.out.print("volatile ");
    }
    System.out.println(dataType.getName());
}

From source file:ModifierUtil.java

public static boolean isStrict(Member member) {
    return Modifier.isStrict(member.getModifiers());
}

From source file:objenome.util.bytecode.SgUtils.java

private static void checkModifiers(int type, int modifiers) {
    for (int modifier = ABSTRACT; modifier <= STRICTFP; modifier++) {
        if (Modifier.isPrivate(modifiers) && !MODIFIERS_MATRIX[PRIVATE][type]) {
            throwIllegalArgument(type, PRIVATE);
        }/*from  w w  w. j  a  v  a  2s .c o m*/
        if (Modifier.isProtected(modifiers) && !MODIFIERS_MATRIX[PROTECTED][type]) {
            throwIllegalArgument(type, PROTECTED);
        }
        if (Modifier.isPublic(modifiers) && !MODIFIERS_MATRIX[PUBLIC][type]) {
            throwIllegalArgument(type, PUBLIC);
        }
        if (Modifier.isStatic(modifiers) && !MODIFIERS_MATRIX[STATIC][type]) {
            throwIllegalArgument(type, STATIC);
        }
        if (Modifier.isAbstract(modifiers) && !MODIFIERS_MATRIX[ABSTRACT][type]) {
            throwIllegalArgument(type, ABSTRACT);
        }
        if (Modifier.isFinal(modifiers) && !MODIFIERS_MATRIX[FINAL][type]) {
            throwIllegalArgument(type, FINAL);
        }
        if (Modifier.isNative(modifiers) && !MODIFIERS_MATRIX[NATIVE][type]) {
            throwIllegalArgument(type, NATIVE);
        }
        if (Modifier.isSynchronized(modifiers) && !MODIFIERS_MATRIX[SYNCHRONIZED][type]) {
            throwIllegalArgument(type, SYNCHRONIZED);
        }
        if (Modifier.isTransient(modifiers) && !MODIFIERS_MATRIX[TRANSIENT][type]) {
            throwIllegalArgument(type, TRANSIENT);
        }
        if (Modifier.isVolatile(modifiers) && !MODIFIERS_MATRIX[VOLATILE][type]) {
            throwIllegalArgument(type, VOLATILE);
        }
        if (Modifier.isStrict(modifiers) && !MODIFIERS_MATRIX[STRICTFP][type]) {
            throwIllegalArgument(type, STRICTFP);
        }
    }
}

From source file:objenome.util.bytecode.SgUtils.java

/**
 * Checks if the modifiers are valid for a method. If any of the modifiers
 * is not valid an <code>IllegalArgumentException</code> is thrown.
 * // w ww  .  ja v a 2 s  .c  om
 * @param modifiers
 *            Modifiers.
 */
// CHECKSTYLE:OFF Cyclomatic complexity is OK
public static void checkMethodModifiers(int modifiers) {

    // Base check
    checkModifiers(METHOD, modifiers);

    // Check overlapping modifiers
    if (Modifier.isPrivate(modifiers)) {
        if (Modifier.isProtected(modifiers) || Modifier.isPublic(modifiers)) {
            throw new IllegalArgumentException(
                    METHOD_ACCESS_MODIFIER_ERROR + " [" + Modifier.toString(modifiers) + ']');
        }
    }
    if (Modifier.isProtected(modifiers)) {
        if (Modifier.isPrivate(modifiers) || Modifier.isPublic(modifiers)) {
            throw new IllegalArgumentException(
                    METHOD_ACCESS_MODIFIER_ERROR + " [" + Modifier.toString(modifiers) + ']');
        }
    }
    if (Modifier.isPublic(modifiers)) {
        if (Modifier.isPrivate(modifiers) || Modifier.isProtected(modifiers)) {
            throw new IllegalArgumentException(
                    METHOD_ACCESS_MODIFIER_ERROR + " [" + Modifier.toString(modifiers) + ']');
        }
    }

    // Check illegal abstract modifiers
    if (Modifier.isAbstract(modifiers)) {
        if (Modifier.isPrivate(modifiers) || Modifier.isStatic(modifiers) || Modifier.isFinal(modifiers)
                || Modifier.isNative(modifiers) || Modifier.isStrict(modifiers)
                || Modifier.isSynchronized(modifiers)) {
            throw new IllegalArgumentException(
                    METHOD_ILLEGAL_ABSTRACT_MODIFIERS_ERROR + " [" + Modifier.toString(modifiers) + ']');
        }
    }

    // Check native and strictfp
    if (Modifier.isNative(modifiers) && Modifier.isStrict(modifiers)) {
        throw new IllegalArgumentException(
                METHOD_NATIVE_STRICTFP_ERROR + " [" + Modifier.toString(modifiers) + ']');
    }

}

From source file:org.lmn.fc.common.utilities.pending.Utilities.java

/***********************************************************************************************
 * Show the Member Modifiers.//ww w. jav a  2s.  c  o  m
 *
 * @param member
 *
 * @return String
 */

public static String showModifiers(final Member member) {
    final int modifiers;
    final StringBuffer buffer;

    buffer = new StringBuffer();

    if (member != null) {
        modifiers = member.getModifiers();

        if (Modifier.isAbstract(modifiers)) {
            buffer.append("Abstract ");
        }

        if (Modifier.isFinal(modifiers)) {
            buffer.append("Final ");
        }

        if (Modifier.isInterface(modifiers)) {
            buffer.append("Interface ");
        }

        if (Modifier.isNative(modifiers)) {
            buffer.append("Native ");
        }

        if (Modifier.isPrivate(modifiers)) {
            buffer.append("Private ");
        }

        if (Modifier.isProtected(modifiers)) {
            buffer.append("Protected ");
        }

        if (Modifier.isPublic(modifiers)) {
            buffer.append("Public ");
        }

        if (Modifier.isStatic(modifiers)) {
            buffer.append("Static ");
        }

        if (Modifier.isStrict(modifiers)) {
            buffer.append("Strict ");
        }

        if (Modifier.isSynchronized(modifiers)) {
            buffer.append("Synchronized ");
        }

        if (Modifier.isTransient(modifiers)) {
            buffer.append("Transient ");
        }

        if (Modifier.isVolatile(modifiers)) {
            buffer.append("Volatile ");
        }
    }

    return (buffer.toString().trim());
}

From source file:com.judoscript.jamaica.parser.JamaicaDumpVisitor.java

static void printAccessFlags(int flags) {
    if (Modifier.isPublic(flags))
        out.print("public ");
    else if (Modifier.isProtected(flags))
        out.print("protected ");
    else if (Modifier.isPrivate(flags))
        out.print("private ");

    if (Modifier.isAbstract(flags))
        out.print("abstract ");
    if (Modifier.isFinal(flags))
        out.print("final ");
    if (Modifier.isNative(flags))
        out.print("native ");
    if (Modifier.isStatic(flags))
        out.print("static ");
    if (Modifier.isStrict(flags))
        out.print("strict ");
    if (Modifier.isSynchronized(flags))
        out.print("synchronized ");
    if (Modifier.isTransient(flags))
        out.print("transient ");
    if (Modifier.isVolatile(flags))
        out.print("volative ");
}

From source file:ca.oson.json.Oson.java

private boolean ignoreModifiers(int modifiers, Set<MODIFIER> includeFieldsWithModifiers) {
    //Set<MODIFIER> includeFieldsWithModifiers = getIncludeFieldsWithModifiers();
    if (includeFieldsWithModifiers == null || includeFieldsWithModifiers.size() == 0) {
        // by default, transient and volatile are ignored
        // unless you specify otherwise, by using MODIFIER.Transient enum, or all
        if (Modifier.isTransient(modifiers)) {
            return true;
        }// w  w  w. ja  v  a2s  .  c o m
        if (Modifier.isVolatile(modifiers)) {
            return true;
        }

        return false;
    }

    if (includeFieldsWithModifiers.contains(MODIFIER.All)) {
        return false;
    }

    for (MODIFIER modifier : includeFieldsWithModifiers) {
        switch (modifier) {
        case Abstract:
            if (Modifier.isAbstract(modifiers)) {
                return false;
            }
            break;
        case Final:
            if (Modifier.isFinal(modifiers)) {
                return false;
            }
            break;
        case Interface:
            if (Modifier.isInterface(modifiers)) {
                return false;
            }
            break;
        case Native:
            if (Modifier.isNative(modifiers)) {
                return false;
            }
            break;
        case Private:
            if (Modifier.isPrivate(modifiers)) {
                return false;
            }
            break;
        case Protected:
            if (Modifier.isProtected(modifiers)) {
                return false;
            }
            break;
        case Public:
            if (Modifier.isPublic(modifiers)) {
                return false;
            }
            break;
        case Package:
            if (ObjectUtil.isPackage(modifiers)) {
                return false;
            }
            break;
        case Static:
            if (Modifier.isStatic(modifiers)) {
                return false;
            }
            break;
        case Strict:
            if (Modifier.isStrict(modifiers)) {
                return false;
            }
            break;
        case Synchronized:
            if (Modifier.isSynchronized(modifiers)) {
                return false;
            }
            break;
        case Transient:
            if (Modifier.isTransient(modifiers)) {
                return false;
            }
            break;
        case Volatile:
            if (Modifier.isVolatile(modifiers)) {
                return false;
            }
            break;
        }
    }

    return true;
}