Example usage for java.lang.reflect Modifier isAbstract

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

Introduction

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

Prototype

public static boolean isAbstract(int mod) 

Source Link

Document

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

Usage

From source file:org.codehaus.groovy.grails.commons.AbstractGrailsClass.java

/**
 * Used by all child classes to create a new instance and get the name right.
 *
 * @param clazz the Grails class/*from  w  ww.j  a  va  2 s .co  m*/
 * @param trailingName the trailing part of the name for this class type
 */
public AbstractGrailsClass(Class<?> clazz, String trailingName) {
    Assert.notNull(clazz, "Clazz parameter should not be null");

    this.clazz = clazz;
    fullName = clazz.getName();
    packageName = ClassUtils.getPackageName(clazz);
    naturalName = GrailsNameUtils.getNaturalName(clazz.getName());
    shortName = ClassUtils.getShortClassName(clazz);
    name = GrailsNameUtils.getLogicalName(clazz, trailingName);
    propertyName = GrailsNameUtils.getPropertyNameRepresentation(shortName);
    if (StringUtils.isBlank(name)) {
        logicalPropertyName = propertyName;
    } else {
        logicalPropertyName = GrailsNameUtils.getPropertyNameRepresentation(name);
    }
    classPropertyFetcher = ClassPropertyFetcher.forClass(clazz);
    isAbstract = Modifier.isAbstract(clazz.getModifiers());
}

From source file:org.datalorax.populace.core.populate.instance.DefaultTypeInstanceFactory.java

private static boolean isConcrete(final Class<?> rawType) {
    return !rawType.isInterface() && !Modifier.isAbstract(rawType.getModifiers());
}

From source file:org.appverse.web.framework.backend.frontfacade.mvc.schema.services.presentation.SchemaGeneratorServiceImpl.java

@RequestMapping(value = "/entities", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<String> listEntities() {
    List<String> data = new ArrayList<String>();
    Set<GenericConverter.ConvertiblePair> list = entityConverter.getConvertibleTypes();
    for (GenericConverter.ConvertiblePair element : list) {
        if (!Modifier.isAbstract(element.getSourceType().getModifiers())) {
            data.add(element.getSourceType().getCanonicalName());
        }// ww w  .jav a 2  s.  c o m
    }
    return data;
}

From source file:org.eclipse.xtend.type.impl.java.JavaTypeImpl.java

@Override
public boolean isAbstract() {
    try {// w w w .j av  a  2 s.com
        return clazz.getConstructor(new Class[0]) == null || Modifier.isAbstract(clazz.getModifiers());
    } catch (final SecurityException e) {
        log.error(e.getMessage(), e);
    } catch (final NoSuchMethodException e) {
        log.error(e.getMessage(), e);
    }
    return true;
}

From source file:org.zilverline.util.ClassFinder.java

/**
 * Convenience method to get a list of classes that can be instantiated.
 * /*from   w  w w . j  a  v  a  2s  .co m*/
 * @param superclass an interface or base class
 * @return Array of discovered classes
 * @throws IOException
 * @throws ClassNotFoundException
 */
public static Class[] getInstantiableSubclasses(Class superclass) throws IOException, ClassNotFoundException {
    ArrayList instantiableSubclasses = new ArrayList();
    List classes = findClassesThatExtend(superclass);
    for (Iterator iter = classes.iterator(); iter.hasNext();) {
        String className = (String) iter.next();
        try {
            log.debug("Trying to instantiate: " + className);
            Class clazz = Class.forName(className);
            int modifiers = clazz.getModifiers();
            if (!Modifier.isAbstract(modifiers)) {
                log.debug("Can instantiate: " + className);
                instantiableSubclasses.add(clazz);
            }
        } catch (Throwable t) {
            log.warn("Can't instantiate: " + className, t);
        }
    }
    return (Class[]) instantiableSubclasses.toArray(new Class[0]);
}

From source file:org.apache.niolex.commons.reflect.MethodFilter.java

/**
 * This is the override of super method.
 * @see org.apache.niolex.commons.reflect.MethodUtil.Filter#isValid(java.lang.reflect.Method)
 *//*  ww  w  .  j av  a2 s.  c  om*/
@Override
public boolean isValid(Method m) {
    if (methodName != null && !methodName.equals(m.getName())) {
        return false;
    }
    if (returnType != null && !ClassUtils.isAssignable(m.getReturnType(), returnType, true)) {
        return false;
    }
    if (parameterTypes != null && !ClassUtils.isAssignable(parameterTypes, m.getParameterTypes(), true)) {
        return false;
    }
    if (!includeStatic && Modifier.isStatic(m.getModifiers())) {
        return false;
    }
    if (!includeAbstract && Modifier.isAbstract(m.getModifiers())) {
        return false;
    }
    if (!includeSynthetic && m.isSynthetic()) {
        return false;
    }
    return true;
}

From source file:org.pentaho.reporting.engine.classic.core.metadata.ReportPreProcessorRegistry.java

public void registerReportPreProcessor(final ReportPreProcessorMetaData metaData) {
    if (metaData == null) {
        throw new NullPointerException();
    }//from w  w w. j av a  2 s  .  c  om
    final Class type = metaData.getPreProcessorType();
    final int modifiers = type.getModifiers();
    if (Modifier.isAbstract(modifiers) || Modifier.isInterface(modifiers)) {
        throw new IllegalArgumentException(
                "report-preprocessor-Implementation cannot be abstract or an interface.");
    }
    this.backend.put(type.getName(), metaData);
}

From source file:de.vandermeer.execs.Skb_Exec.java

/**
 * Adds a set of service at runtime, as in all found SKB services that can be executed
 * @param set a set of services//www  .  j av  a  2s .c  o m
 */
protected void addAllServices(Set<Class<?>> set) {
    for (Class<?> cls : set) {
        if (!cls.isInterface() && !Modifier.isAbstract(cls.getModifiers())) {
            if (!this.byClass.containsValue(cls)) {
                this.byName.add(cls.getName());
            }
        }
    }
}

From source file:org.opoo.util.ClassUtils.java

public static boolean isAbstractClass(Class clazz) {
    int modifier = clazz.getModifiers();
    return Modifier.isAbstract(modifier) || Modifier.isInterface(modifier);
}

From source file:plugins.ApiHelpInventory.java

private boolean isRessource(Class<?> javaClass) {

    // ignore interfaces and abstract classes
    if (javaClass.isInterface() || Modifier.isAbstract(javaClass.getModifiers())) {
        return false;
    }//from ww w  . j a  v a  2 s. co m

    // check for @Path or @Provider annotation
    if (hasAnnotation(javaClass, Path.class)) {
        return true;
    }

    return false;
}