本文整理汇总了Java中java.lang.reflect.Modifier.NATIVE属性的典型用法代码示例。如果您正苦于以下问题:Java Modifier.NATIVE属性的具体用法?Java Modifier.NATIVE怎么用?Java Modifier.NATIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.lang.reflect.Modifier
的用法示例。
在下文中一共展示了Modifier.NATIVE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModifiers
private static int getModifiers(ClassInfo ci, int mIndex) {
int modifiers = 0;
if (ci.isMethodAbstract(mIndex)) {
modifiers += Modifier.ABSTRACT;
}
if (ci.isMethodPrivate(mIndex)) {
modifiers += Modifier.PRIVATE;
}
if (ci.isMethodProtected(mIndex)) {
modifiers += Modifier.PROTECTED;
}
if (ci.isMethodPublic(mIndex)) {
modifiers += Modifier.PUBLIC;
}
if (ci.isMethodFinal(mIndex)) {
modifiers += Modifier.FINAL;
}
if (ci.isMethodStatic(mIndex)) {
modifiers += Modifier.STATIC;
}
if (ci.isMethodNative(mIndex)) {
modifiers += Modifier.NATIVE;
}
return modifiers;
}
示例2: main
public static void main(String [] argv) {
int allMods = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
Modifier.ABSTRACT | Modifier.STATIC | Modifier.FINAL |
Modifier.TRANSIENT | Modifier.VOLATILE | Modifier.SYNCHRONIZED |
Modifier.NATIVE | Modifier.STRICT | Modifier.INTERFACE;
String allModsString = "public protected private abstract static " +
"final transient volatile synchronized native strictfp interface";
/* zero should have an empty string */
testString(0, "");
/* test to make sure all modifiers print out in the proper order */
testString(allMods, allModsString);
/* verify no extraneous modifiers are printed */
testString(~0, allModsString);
}
示例3: translateModifiers
/**
* Convert modifier bits from private coding used by
* the compiler to that of java.lang.reflect.Modifier.
*/
static int translateModifiers(long flags) {
int result = 0;
if ((flags & Flags.ABSTRACT) != 0)
result |= Modifier.ABSTRACT;
if ((flags & Flags.FINAL) != 0)
result |= Modifier.FINAL;
if ((flags & Flags.INTERFACE) != 0)
result |= Modifier.INTERFACE;
if ((flags & Flags.NATIVE) != 0)
result |= Modifier.NATIVE;
if ((flags & Flags.PRIVATE) != 0)
result |= Modifier.PRIVATE;
if ((flags & Flags.PROTECTED) != 0)
result |= Modifier.PROTECTED;
if ((flags & Flags.PUBLIC) != 0)
result |= Modifier.PUBLIC;
if ((flags & Flags.STATIC) != 0)
result |= Modifier.STATIC;
if ((flags & Flags.SYNCHRONIZED) != 0)
result |= Modifier.SYNCHRONIZED;
if ((flags & Flags.TRANSIENT) != 0)
result |= Modifier.TRANSIENT;
if ((flags & Flags.VOLATILE) != 0)
result |= Modifier.VOLATILE;
return result;
}
示例4: flagsRequireCode
static boolean flagsRequireCode(int flags) {
// A method's flags force it to have a Code attribute,
// if the flags are neither native nor abstract.
return (flags & (Modifier.NATIVE | Modifier.ABSTRACT)) == 0;
}
示例5: modifiersFrom
public static long modifiersFrom( Set<javax.lang.model.element.Modifier> modifiers )
{
long mods = 0;
for( javax.lang.model.element.Modifier mod : modifiers )
{
switch( mod )
{
case PUBLIC:
mods |= Modifier.PUBLIC;
break;
case PROTECTED:
mods |= Modifier.PROTECTED;
break;
case PRIVATE:
mods |= Modifier.PRIVATE;
break;
case ABSTRACT:
mods |= Modifier.ABSTRACT;
break;
case DEFAULT:
mods |= Flags.DEFAULT;
break;
case STATIC:
mods |= Modifier.STATIC;
break;
case FINAL:
mods |= Modifier.FINAL;
break;
case TRANSIENT:
mods |= Modifier.TRANSIENT;
break;
case VOLATILE:
mods |= Modifier.VOLATILE;
break;
case SYNCHRONIZED:
mods |= Modifier.SYNCHRONIZED;
break;
case NATIVE:
mods |= Modifier.NATIVE;
break;
case STRICTFP:
mods |= Flags.STRICTFP;
break;
}
}
return mods;
}
示例6: modifierString
/**
* Return a string describing the access modifier flags.
* Don't include native or synchronized.
*
* The modifier names are returned in canonical order, as
* specified by <em>The Java Language Specification</em>.
*/
protected String modifierString(MemberDoc member) {
int ms = member.modifierSpecifier();
int no = Modifier.NATIVE | Modifier.SYNCHRONIZED;
return Modifier.toString(ms & ~no);
}