当前位置: 首页>>代码示例>>Java>>正文


Java Modifier.ABSTRACT属性代码示例

本文整理汇总了Java中java.lang.reflect.Modifier.ABSTRACT属性的典型用法代码示例。如果您正苦于以下问题:Java Modifier.ABSTRACT属性的具体用法?Java Modifier.ABSTRACT怎么用?Java Modifier.ABSTRACT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.lang.reflect.Modifier的用法示例。


在下文中一共展示了Modifier.ABSTRACT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ExternalPackages.java

示例2: filterMethods

/**
 * Filter all methods to ensure following conditions:
 *
 * <ul><li>Method name is @name</li>
 *
 * <li>Method is <tt>public<tt></li>
 *
 * <li>Method is not <tt>abstract</tt></li>.
 *
 * <li>Method does not have variable number of arguments</li>
 *
 * <li>Return type of method is @returnType</li>
 *
 * <li>All parameter fields are of type {@link String}, {@link Integer} or {@link Double}</li>
 *
 * <li>All parameters are annotated with {@link Param}</li> </ul>
 *
 * @param methods Array of methods to be filtered.
 * @param seekedName Name of the methods we are looking for.
 * @param returnType Expected return type of filtered methods.
 * @return Array of methods with @name.
 */
private Method[] filterMethods(Method[] methods, String seekedName, Class<?> returnType) {
    List<Method> filteredMethods = new LinkedList<Method>();

    for (Method testedMethod : methods) {
        String testedMethodName = testedMethod.getName();
        boolean methodIsPublic = (testedMethod.getModifiers() & Modifier.PUBLIC) == Modifier.PUBLIC;
        boolean methodIsAbstract = (testedMethod.getModifiers() & Modifier.ABSTRACT) == Modifier.ABSTRACT;
        boolean correctReturnType = returnType.isAssignableFrom(testedMethod.getReturnType());
        boolean acceptedParams = areParamsAcceptable(testedMethod, true, allowedParamClasses);
        boolean annotatedParams = areParamsAnnotated(testedMethod);

        if (testedMethodName.equals(seekedName)
                && methodIsPublic
                && !methodIsAbstract
                && !testedMethod.isVarArgs()
                && correctReturnType
                && acceptedParams
                && annotatedParams) {
            filteredMethods.add(testedMethod);
        }
    }
    return filteredMethods.toArray(new Method[filteredMethods.size()]);
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:45,代码来源:ParamsMethod.java

示例3: 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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:toStringTest.java

示例4: visitAnnotation

@Override
public boolean visitAnnotation(Annotation node) {
  String type = node.astAnnotationTypeReference().getTypeName();
  if (DAGGER_MODULE.equals(type)) {
    Node parent = node.getParent();
    if (parent instanceof Modifiers) {
      parent = parent.getParent();
      if (parent instanceof ClassDeclaration) {
        int flags = ((ClassDeclaration) parent).astModifiers().getEffectiveModifierFlags();
        if ((flags & Modifier.ABSTRACT) == 0) {
          context.report(ISSUE, Location.create(context.file), ISSUE.getBriefDescription(TextFormat.TEXT));
        }
      }
    }
  }

  return super.visitAnnotation(node);
}
 
开发者ID:ashdavies,项目名称:dagger-lint,代码行数:18,代码来源:ConcreteModuleDetector.java

示例5: getModifiers

@Override
public int getModifiers() {
    if (isArray()) {
        return (getElementalType().getModifiers() & (Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED)) | Modifier.FINAL | Modifier.ABSTRACT;
    } else {
        return getAccessFlags() & jvmClassModifiers();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:HotSpotResolvedObjectTypeImpl.java

示例6: getModifiers

@MethodSubstitution(isStatic = false)
public static int getModifiers(final Class<?> thisObj) {
    KlassPointer klass = ClassGetHubNode.readClass(thisObj);
    if (klass.isNull()) {
        // Class for primitive type
        return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC;
    } else {
        return klass.readInt(klassModifierFlagsOffset(INJECTED_VMCONFIG), KLASS_MODIFIER_FLAGS_LOCATION);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:HotSpotClassSubstitutions.java

示例7: getClassAccessFlags

@MethodSubstitution
public static int getClassAccessFlags(Class<?> aClass) {
    KlassPointer klass = ClassGetHubNode.readClass(GraalDirectives.guardingNonNull(aClass));
    if (klass.isNull()) {
        // Class for primitive type
        return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC;
    } else {
        return klass.readInt(klassAccessFlagsOffset(INJECTED_VMCONFIG), KLASS_ACCESS_FLAGS_LOCATION) & jvmAccWrittenFlags(INJECTED_VMCONFIG);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:ReflectionSubstitutions.java

示例8: addOccupant

private void addOccupant(T occupant) {
    Class cl = occupant.getClass();
    do {
        if ((cl.getModifiers() & Modifier.ABSTRACT) == 0)
            occupantClasses.add(cl);
        cl = cl.getSuperclass();
    } while (cl != Object.class);
}
 
开发者ID:CBSkarmory,项目名称:AWGW,代码行数:8,代码来源:GUIController.java

示例9: modifierSpecifier

@Override
public int modifierSpecifier() {
    int modifiers = getModifiers();
    return (isInterface() || isAnnotationType())
            ? modifiers & ~Modifier.ABSTRACT
            : modifiers;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:ClassDocImpl.java

示例10: SignatureHolder

private SignatureHolder(Class<?> signature, SignatureHolder[] childHolders) {
  this.childHolders = childHolders;
  this.signature = signature;
  Map<String, Integer> newMap = Maps.newHashMap();

  List<CodeGeneratorMethod> methodHolders = Lists.newArrayList();
  Method[] reflectMethods = signature.getDeclaredMethods();

  for (Method m : reflectMethods) {
    if ( (m.getModifiers() & Modifier.ABSTRACT) == 0 && m.getAnnotation(RuntimeOverridden.class) == null) {
      continue;
    }
    methodHolders.add(new CodeGeneratorMethod(m));
  }

  methods = new CodeGeneratorMethod[methodHolders.size()+1];
  for (int i =0; i < methodHolders.size(); i++) {
    methods[i] = methodHolders.get(i);
    Integer old = newMap.put(methods[i].getMethodName(), i);
    if (old != null) {
      throw new IllegalStateException(String.format("Attempting to add a method with name %s when there is already one method of that name in this class that is set to be runtime generated.", methods[i].getMethodName()));
    }

  }
  methods[methodHolders.size()] = INIT;
  newMap.put(INIT.getMethodName(), methodHolders.size());

  methodMap = ImmutableMap.copyOf(newMap);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:29,代码来源:SignatureHolder.java

示例11: getKlassFlags

private static int getKlassFlags(Class<?> klass) {
    int flags = TypeKlass.NONE;
    if (klass.isInterface()) {
        flags = flags | TypeKlass.INTERFACE;
    } else if ((klass.getModifiers() & Modifier.ABSTRACT) != 0) {
        flags = flags | TypeKlass.ABSTRACT;
    } else if ((klass.getModifiers() & Modifier.FINAL) != 0) {
        flags = flags | TypeKlass.FINAL;
    }
    return flags;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TypesParser.java

示例12: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:DocEnv.java

示例13: getInheritableMethod

/**
 * Returns non-static, non-abstract method with given signature provided it
 * is defined by or accessible (via inheritance) by the given class, or
 * null if no match found.  Access checks are disabled on the returned
 * method (if any).
 */
private static Method getInheritableMethod(Class<?> cl, String name,
                                           Class<?>[] argTypes,
                                           Class<?> returnType)
{
    Method meth = null;
    Class<?> defCl = cl;
    while (defCl != null) {
        try {
            meth = defCl.getDeclaredMethod(name, argTypes);
            break;
        } catch (NoSuchMethodException ex) {
            defCl = defCl.getSuperclass();
        }
    }

    if ((meth == null) || (meth.getReturnType() != returnType)) {
        return null;
    }
    meth.setAccessible(true);
    int mods = meth.getModifiers();
    if ((mods & (Modifier.STATIC | Modifier.ABSTRACT)) != 0) {
        return null;
    } else if ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) {
        return meth;
    } else if ((mods & Modifier.PRIVATE) != 0) {
        return (cl == defCl) ? meth : null;
    } else {
        return packageEquals(cl, defCl) ? meth : null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:ObjectStreamClass.java

示例14: getModifiers

@Override
public int getModifiers() {
    return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:HotSpotResolvedPrimitiveType.java

示例15: isDefault

public boolean isDefault() {
    // Copied from java.lang.Method.isDefault()
    int mask = Modifier.ABSTRACT | Modifier.PUBLIC | Modifier.STATIC;
    return ((getModifiers() & mask) == Modifier.PUBLIC) && getDeclaringClass().isInterface();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:HotSpotResolvedJavaMethodImpl.java


注:本文中的java.lang.reflect.Modifier.ABSTRACT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。