Java Code Examples for java.lang.reflect.Modifier#isStrict()

The following examples show how to use java.lang.reflect.Modifier#isStrict() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModifiedFragment.java    From halo-docs with Apache License 2.0 5 votes vote down vote up
@Override
public <T extends LineAppender<T>> void joinTo(T appender, Preference preference) throws IOException {
    if (Modifier.isPublic(modifier)) appender.append("public ");
    if (Modifier.isProtected(modifier)) appender.append("protected ");
    if (Modifier.isPrivate(modifier)) appender.append("private ");
    if (Modifier.isAbstract(modifier)) appender.append("abstract ");
    if (Modifier.isStatic(modifier)) appender.append("static ");
    if (Modifier.isFinal(modifier)) appender.append("final ");
    if (Modifier.isInterface(modifier)) appender.append("interface ");
    if (Modifier.isVolatile(modifier)) appender.append("volatile ");
    if (Modifier.isNative(modifier)) appender.append("native ");
    if (Modifier.isStrict(modifier)) appender.append("strict ");
    if (Modifier.isSynchronized(modifier)) appender.append("synchronized ");
    if (Modifier.isTransient(modifier)) appender.append("transient ");
}
 
Example 2
Source File: ModifiedFragment.java    From httpdoc with Apache License 2.0 5 votes vote down vote up
@Override
public <T extends LineAppender<T>> void joinTo(T appender, Preference preference) throws IOException {
    if (Modifier.isPublic(modifier)) appender.append("public ");
    if (Modifier.isProtected(modifier)) appender.append("protected ");
    if (Modifier.isPrivate(modifier)) appender.append("private ");
    if (Modifier.isAbstract(modifier)) appender.append("abstract ");
    if (Modifier.isStatic(modifier)) appender.append("static ");
    if (Modifier.isFinal(modifier)) appender.append("final ");
    if (Modifier.isInterface(modifier)) appender.append("interface ");
    if (Modifier.isVolatile(modifier)) appender.append("volatile ");
    if (Modifier.isNative(modifier)) appender.append("native ");
    if (Modifier.isStrict(modifier)) appender.append("strict ");
    if (Modifier.isSynchronized(modifier)) appender.append("synchronized ");
    if (Modifier.isTransient(modifier)) appender.append("transient ");
}
 
Example 3
Source File: Utils.java    From apkfile with Apache License 2.0 5 votes vote down vote up
public static void updateAccessorCounts(TObjectIntMap<String> counts, int[] accessFlags) {
    for (int accessFlag : accessFlags) {
        if (Modifier.isPublic(accessFlag)) {
            counts.adjustOrPutValue("public", 1, 1);
        }
        if (Modifier.isProtected(accessFlag)) {
            counts.adjustOrPutValue("protected", 1, 1);
        }
        if (Modifier.isPrivate(accessFlag)) {
            counts.adjustOrPutValue("private", 1, 1);
        }
        if (Modifier.isFinal(accessFlag)) {
            counts.adjustOrPutValue("final", 1, 1);
        }
        if (Modifier.isInterface(accessFlag)) {
            counts.adjustOrPutValue("interface", 1, 1);
        }
        if (Modifier.isNative(accessFlag)) {
            counts.adjustOrPutValue("native", 1, 1);
        }
        if (Modifier.isStatic(accessFlag)) {
            counts.adjustOrPutValue("static", 1, 1);
        }
        if (Modifier.isStrict(accessFlag)) {
            counts.adjustOrPutValue("strict", 1, 1);
        }
        if (Modifier.isSynchronized(accessFlag)) {
            counts.adjustOrPutValue("synchronized", 1, 1);
        }
        if (Modifier.isTransient(accessFlag)) {
            counts.adjustOrPutValue("transient", 1, 1);
        }
        if (Modifier.isVolatile(accessFlag)) {
            counts.adjustOrPutValue("volatile", 1, 1);
        }
        if (Modifier.isAbstract(accessFlag)) {
            counts.adjustOrPutValue("abstract", 1, 1);
        }
    }
}
 
Example 4
Source File: DebugASTPrinter.java    From j2objc with Apache License 2.0 5 votes vote down vote up
protected void printModifiers(int modifiers) {
  if (Modifier.isPublic(modifiers)) {
    sb.print("public ");
  }
  if (Modifier.isProtected(modifiers)) {
    sb.print("protected ");
  }
  if (Modifier.isPrivate(modifiers)) {
    sb.print("private ");
  }
  if (Modifier.isStatic(modifiers)) {
    sb.print("static ");
  }
  if (Modifier.isAbstract(modifiers)) {
    sb.print("abstract ");
  }
  if (Modifier.isFinal(modifiers)) {
    sb.print("final ");
  }
  if (Modifier.isSynchronized(modifiers)) {
    sb.print("synchronized ");
  }
  if (Modifier.isVolatile(modifiers)) {
    sb.print("volatile ");
  }
  if (Modifier.isNative(modifiers)) {
    sb.print("native ");
  }
  if (Modifier.isStrict(modifiers)) {
    sb.print("strictfp ");
  }
  if (Modifier.isTransient(modifiers)) {
    sb.print("transient ");
  }
  if ((modifiers & ElementUtil.ACC_SYNTHETIC) > 0) {
    sb.print("synthetic ");
  }
}
 
Example 5
Source File: ClassFieldDescription.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
protected ClassFieldDescription(final Class<?> referenceClass, final Field field,
        final ClassFieldDescription parent, final int recursionLevel) {
    super();
    hierarchyDepth = recursionLevel;
    this.parent = parent == null ? Optional.empty() : Optional.of(parent);

    if (referenceClass == null) {
        if (field == null) {
            throw new IllegalArgumentException("field must not be null");
        }
        this.field = field;
        classType = field.getType();
        fieldName = field.getName();
        if (this.parent.isPresent()) {
            final String relativeName = this.parent.get().isRoot() ? "" : (this.parent.get().getFieldNameRelative() + ".");
            fieldNameRelative = relativeName + fieldName;
        } else {
            fieldNameRelative = fieldName;
        }

        modifierID = field.getModifiers();
    } else {
        this.field = null; // it's a root, no field definition available
        classType = referenceClass;
        fieldName = classType.getName();
        fieldNameRelative = "";

        modifierID = classType.getModifiers();
    }

    dataType = dataTypeFomClassType(classType);
    typeName = ClassDescriptions.translateClassName(classType.getTypeName());

    modPublic = Modifier.isPublic(modifierID);
    modProtected = Modifier.isProtected(modifierID);
    modPrivate = Modifier.isPrivate(modifierID);

    modAbstract = Modifier.isAbstract(modifierID);
    modStatic = Modifier.isStatic(modifierID);
    modFinal = Modifier.isFinal(modifierID);
    modTransient = Modifier.isTransient(modifierID);
    modVolatile = Modifier.isVolatile(modifierID);
    modSynchronized = Modifier.isSynchronized(modifierID);
    modNative = Modifier.isNative(modifierID);
    modStrict = Modifier.isStrict(modifierID);
    modInterface = classType.isInterface();

    // additional fields
    isprimitive = classType.isPrimitive();
    isclass = !isprimitive && !modInterface;
    isEnum = Enum.class.isAssignableFrom(classType);
    serializable = !modTransient && !modStatic;
}
 
Example 6
Source File: StringUtils.java    From arthas with Apache License 2.0 4 votes vote down vote up
/**
 * 翻译Modifier值
 *
 * @param mod modifier
 * @return 翻译值
 */
public static String modifier(int mod, char splitter) {
    StringBuilder sb = new StringBuilder();
    if (Modifier.isAbstract(mod)) {
        sb.append("abstract").append(splitter);
    }
    if (Modifier.isFinal(mod)) {
        sb.append("final").append(splitter);
    }
    if (Modifier.isInterface(mod)) {
        sb.append("interface").append(splitter);
    }
    if (Modifier.isNative(mod)) {
        sb.append("native").append(splitter);
    }
    if (Modifier.isPrivate(mod)) {
        sb.append("private").append(splitter);
    }
    if (Modifier.isProtected(mod)) {
        sb.append("protected").append(splitter);
    }
    if (Modifier.isPublic(mod)) {
        sb.append("public").append(splitter);
    }
    if (Modifier.isStatic(mod)) {
        sb.append("static").append(splitter);
    }
    if (Modifier.isStrict(mod)) {
        sb.append("strict").append(splitter);
    }
    if (Modifier.isSynchronized(mod)) {
        sb.append("synchronized").append(splitter);
    }
    if (Modifier.isTransient(mod)) {
        sb.append("transient").append(splitter);
    }
    if (Modifier.isVolatile(mod)) {
        sb.append("volatile").append(splitter);
    }
    if (sb.length() > 0) {
        sb.deleteCharAt(sb.length() - 1);
    }
    return sb.toString();
}
 
Example 7
Source File: Solution.java    From JavaRushTasks with MIT License 4 votes vote down vote up
public static boolean isAllModifiersContainSpecificModifier(int allModifiers, int specificModifier) {
    if (Modifier.isAbstract(allModifiers) && Modifier.isAbstract(specificModifier))
        return true;

    if (Modifier.isFinal(allModifiers) && Modifier.isFinal(specificModifier))
        return true;

    if (Modifier.isInterface(allModifiers) && Modifier.isInterface(specificModifier))
        return true;

    if (Modifier.isNative(allModifiers) && Modifier.isNative(specificModifier))
        return true;

    if (Modifier.isPrivate(allModifiers) && Modifier.isPrivate(specificModifier))
        return true;

    if (Modifier.isProtected(allModifiers) && Modifier.isProtected(specificModifier))
        return true;

    if (Modifier.isPublic(allModifiers) && Modifier.isPublic(specificModifier))
        return true;

    if (Modifier.isStatic(allModifiers) && Modifier.isStatic(specificModifier))
        return true;

    if (Modifier.isStrict(allModifiers) && Modifier.isStrict(specificModifier))
        return true;

    if (Modifier.isSynchronized(allModifiers) && Modifier.isSynchronized(specificModifier))
        return true;

    if (Modifier.isTransient(allModifiers) && Modifier.isTransient(specificModifier))
        return true;

    if (Modifier.isVolatile(allModifiers) && Modifier.isVolatile(specificModifier))
        return true;

    if (Modifier.isVolatile(allModifiers) && Modifier.isVolatile(specificModifier))
        return true;

    return false;
}
 
Example 8
Source File: ModifiersProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @see Modifier#isStrict(int)
 */
default boolean isStrict() {
    return Modifier.isStrict(getModifiers());
}
 
Example 9
Source File: ClassTool.java    From velocity-tools with Apache License 2.0 4 votes vote down vote up
/**
 * @return whether the inspected object is strictfp
 */
public boolean isStrict()
{
    return Modifier.isStrict(getModifiers());
}
 
Example 10
Source File: ClassTool.java    From velocity-tools with Apache License 2.0 2 votes vote down vote up
/**
 * Returns true if the inspected Class is declared strictfp
 * (uses strict floating point math).
 * @return whether the inspected class is strictfp
 */
public boolean isStrict()
{
    return Modifier.isStrict(getType().getModifiers());
}