Example usage for java.lang Class isAnnotationPresent

List of usage examples for java.lang Class isAnnotationPresent

Introduction

In this page you can find the example usage for java.lang Class isAnnotationPresent.

Prototype

@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) 

Source Link

Usage

From source file:org.mentawai.annotations.ApplicationManagerWithAnnotations.java

@SuppressWarnings("rawtypes")
public void loadAnnotatedClasses() {
    ActionConfig ac;//from ww w . j a v  a 2  s.  c o  m
    ArrayList<ActionConfig> acListForChains = new ArrayList<ActionConfig>();

    // Para carregamento das Chains
    ArrayList<String> actionName = new ArrayList<String>();
    ArrayList<String> innerActionName = new ArrayList<String>();
    ArrayList<String> actionChain = new ArrayList<String>();
    ArrayList<String> innerChain = new ArrayList<String>();

    if (resources == null) {
        System.out.println("NO RESOURCES DEFINED");
        return;
    }

    try {
        System.out.println("Searching for annotated classes inside package [" + resources + "]...");
        findAnnotatedClasses(resources);
    } catch (Exception e) {
        System.out.println("COULD NOT LOAD PACKAGE ANNOTATED CLASSES: ");
        e.printStackTrace();
        return;
    }
    HashSet<Class> annotatedRemove = new HashSet<Class>();
    for (Class<? extends Object> klass : annotatedClasses) {
        if (klass.getSuperclass().isAnnotationPresent(ActionClass.class)) {
            annotatedRemove.add(klass.getSuperclass());
            System.out.println("REMOVING " + klass.getSuperclass()
                    + ": this actions will be mapped by its subclass " + klass.getName() + ".");
        }
    }
    for (Class<? extends Object> klass2Remove : annotatedRemove) {
        annotatedClasses.remove(klass2Remove);
    }

    if (annotatedClasses.size() > 0) {
        for (Class<? extends Object> klass : annotatedClasses) {
            if (klass.isAnnotationPresent(ActionClass.class)) {
                System.out.println("LOADING ANNOTATED ACTION CLASS: " + klass.getName());

                // Mapear o prefixo da ao com a classe de ao
                ActionClass annotation = klass.getAnnotation(ActionClass.class);
                if (getActions().containsKey(annotation.prefix())) {
                    ac = getActions().get(annotation.prefix());
                    if (ac.getActionClass().isAssignableFrom(klass)) {
                        ac = new ActionConfig(annotation.prefix(), klass);
                    }
                } else
                    ac = new ActionConfig(annotation.prefix(), klass);

                // Mapear as consequencias default (sem mtodo de ao) da
                // classe
                ConsequenceOutput[] outputsClass = annotation.outputs();
                if (outputsClass != null && outputsClass.length > 0) {
                    for (ConsequenceOutput output : outputsClass) {
                        if (output.type() == ConsequenceType.FORWARD) {
                            // Caso seja a consequencia padro, mapear
                            // sucesso e erro para a mesma pgina
                            if (ConsequenceOutput.SUCCESS_ERROR.equals(output.result())) {
                                ac.addConsequence(SUCCESS, new Forward(output.page()));
                                ac.addConsequence(ERROR, new Forward(output.page()));
                            } else
                                ac.addConsequence(output.result(), new Forward(output.page()));
                        } else if (output.type() == ConsequenceType.REDIRECT) {
                            ac.addConsequence(output.result(),
                                    "".equals(output.page()) ? new Redirect(output.RedirectWithParameters())
                                            : new Redirect(output.page(), output.RedirectWithParameters()));
                        } else if (output.type() == ConsequenceType.STREAMCONSEQUENCE) {
                            ac.addConsequence(output.result(),
                                    "".equals(output.page()) ? new StreamConsequence()
                                            : new StreamConsequence(output.page()));
                        } else if (output.type() == ConsequenceType.AJAXCONSEQUENCE) {
                            try {
                                AjaxRenderer ajaxRender = (AjaxRenderer) Class.forName(output.page())
                                        .newInstance();
                                ac.addConsequence(output.result(), new AjaxConsequence(ajaxRender));
                            } catch (InstantiationException ex) {
                                ac.addConsequence(output.result(), new AjaxConsequence(new MapAjaxRenderer()));
                            } catch (Exception ex) {
                                System.out.println(
                                        "COULD NOT LOAD AJAX CONSEQUENCE, LOADED DEFAULT MapAjaxRenderer");
                                ex.printStackTrace();
                            }
                        } else if (output.type() == ConsequenceType.CUSTOM) {
                            try {
                                Consequence customObject = (Consequence) Class.forName(output.page())
                                        .newInstance();
                                ac.addConsequence(output.result(), customObject);
                            } catch (Exception ex) {
                                System.out.println("COULD NOT LOAD CUSTOM CONSEQUENCE: ACTION NOT LOADED: "
                                        + klass.getSimpleName());
                                ex.printStackTrace();
                            }
                        }
                    }
                }

                // Mapear os mtodos de aes da classe
                for (Method method : klass.getMethods()) {
                    if (method.isAnnotationPresent(Consequences.class)) {
                        System.out.println(
                                "LOADING CONSEQUENCE: " + annotation.prefix() + "." + method.getName());

                        // Buscar as consequencias anotadas na classe de
                        // ao
                        ConsequenceOutput[] mapConsequences = method.getAnnotation(Consequences.class)
                                .outputs();

                        // Mapeando as consequencias
                        if (mapConsequences != null && mapConsequences.length > 0) {
                            for (ConsequenceOutput output : mapConsequences) {
                                if (output.type() == ConsequenceType.FORWARD) {
                                    // Caso seja a consequencia padro,
                                    // mapear sucesso e erro para a mesma
                                    // pgina
                                    if (ConsequenceOutput.SUCCESS_ERROR.equals(output.result())) {
                                        ac.addConsequence(SUCCESS, method.getName(),
                                                new Forward(output.page()));
                                        ac.addConsequence(ERROR, method.getName(), new Forward(output.page()));
                                    } else
                                        ac.addConsequence(output.result(), method.getName(),
                                                new Forward(output.page()));
                                } else if (output.type() == ConsequenceType.REDIRECT) {
                                    Consequence c = null;
                                    if (output.page().equals("")) {
                                        c = new Redirect(output.RedirectWithParameters());
                                    } else {
                                        c = new Redirect(output.page(), output.RedirectWithParameters());
                                    }
                                    if (ConsequenceOutput.SUCCESS_ERROR.equals(output.result())) {
                                        ac.addConsequence(SUCCESS, method.getName(), c);
                                        ac.addConsequence(ERROR, method.getName(), c);
                                    } else {
                                        ac.addConsequence(output.result(), method.getName(), c);
                                    }
                                } else if (output.type() == ConsequenceType.STREAMCONSEQUENCE) {
                                    ac.addConsequence(output.result(), method.getName(),
                                            "".equals(output.page()) ? new StreamConsequence()
                                                    : new StreamConsequence(output.page()));
                                } else if (output.type() == ConsequenceType.AJAXCONSEQUENCE) {
                                    try {
                                        AjaxRenderer ajaxRender = (AjaxRenderer) Class.forName(output.page())
                                                .newInstance();
                                        ac.addConsequence(output.result(), method.getName(),
                                                new AjaxConsequence(ajaxRender));
                                    } catch (InstantiationException ex) {
                                        ac.addConsequence(output.result(), method.getName(),
                                                new AjaxConsequence(new MapAjaxRenderer()));
                                    } catch (Exception ex) {
                                        System.out.println(
                                                "COULD NOT LOAD AJAX CONSEQUENCE, LOADED DEFAULT MapAjaxRenderer");
                                        ex.printStackTrace();
                                    }
                                } else if (output.type() == ConsequenceType.CUSTOM) {
                                    try {
                                        Consequence customObject = (Consequence) Class.forName(output.page())
                                                .newInstance();
                                        ac.addConsequence(output.result(), method.getName(), customObject);
                                    } catch (Exception ex) {
                                        System.out.println(
                                                "COULD NOT LOAD CUSTOM CONSEQUENCE: ACTION NOT LOADED: "
                                                        + klass.getSimpleName() + "." + method.getName());
                                        ex.printStackTrace();
                                    }
                                } else if (output.type() == ConsequenceType.CHAIN) {
                                    String[] explodedParameter = output.page().split("\\."); // Usado
                                    // para
                                    // explodir
                                    // parameters
                                    // no
                                    // caso
                                    // de
                                    // uma
                                    // chain
                                    actionName.add(output.result());
                                    innerActionName.add(method.getName());
                                    actionChain.add(explodedParameter[0]);
                                    innerChain.add(explodedParameter.length > 1 ? explodedParameter[1] : null);
                                    acListForChains.add(ac);
                                }
                            }
                        }
                    }
                }
                add(ac);
            }
        }
    }

    // Carrega as chains atrasadas porque os ActionConfigs podem ainda nao
    // ter sido carregados
    int length = actionName.size();
    Chain chain;
    for (int i = 0; i < length; i++) {
        try {
            ac = acListForChains.get(i);
            if (innerChain.get(i) == null)
                chain = new Chain(getActionConfig(actionChain.get(i)));
            else
                chain = new Chain(getActionConfig(actionChain.get(i)), innerChain.get(i));
            if (actionName.get(i).equals(ConsequenceOutput.SUCCESS_ERROR)) {
                ac.addConsequence(SUCCESS, innerActionName.get(i), chain);
                ac.addConsequence(ERROR, innerActionName.get(i), chain);
            } else {
                ac.addConsequence(actionName.get(i), innerActionName.get(i), chain);
            }

        } catch (Exception e) {
            System.out.println("COULD NOT LOAD CHAIN CONSEQUENCE: ACTION NOT LOADED: " + actionChain.get(i)
                    + "." + innerActionName.get(i));
        }
    }
}

From source file:org.apache.shindig.protocol.DefaultHandlerRegistry.java

/**
 * Add handlers to the registry//  w  w w. j  a  v  a2  s .  c  o  m
 *
 * @param handlers
 */
@Override
public void addHandlers(Set<Object> handlers) {
    for (final Object handler : handlers) {
        Class<?> handlerType;
        Provider<?> handlerProvider;
        if (handler instanceof Class<?>) {
            handlerType = (Class<?>) handler;
            handlerProvider = injector.getProvider(handlerType);
        } else {
            handlerType = handler.getClass();
            handlerProvider = new Provider<Object>() {
                @Override
                public Object get() {
                    return handler;
                }
            };
        }
        Preconditions.checkState(handlerType.isAnnotationPresent(Service.class),
                "Attempt to bind unannotated service implementation %s", handlerType.getName());

        Service service = handlerType.getAnnotation(Service.class);

        for (Method m : handlerType.getMethods()) {
            if (m.isAnnotationPresent(Operation.class)) {
                Operation op = m.getAnnotation(Operation.class);
                createRpcHandler(handlerProvider, service, op, m);
                createRestHandler(handlerProvider, service, op, m);
            }
        }
    }
}

From source file:org.j2free.admin.ReflectionMarshaller.java

private ReflectionMarshaller(Class klass) throws Exception {

    instructions = new HashMap<Field, Converter>();

    LinkedList<Field> fieldsToMarshall = new LinkedList<Field>();

    // Only marshallOut entities
    if (!klass.isAnnotationPresent(Entity.class))
        throw new Exception("Provided class is not an @Entity");

    // Add the declared fields
    fieldsToMarshall.addAll(Arrays.asList(klass.getDeclaredFields()));

    /* Inheritence support
     * Continue up the inheritance ladder until:
     *   - There are no more super classes (zuper == null), or
     *   - The super class is not an @Entity
     *//*  www . j a  v a2s .  c o  m*/
    Class zuper = klass;
    while ((zuper = zuper.getSuperclass()) != null) {

        // get out if we find a super class that isn't an @Entity
        if (!klass.isAnnotationPresent(Entity.class))
            break;

        // Add the declared fields
        // @todo, improve the inheritance support, the current way will overwrite
        // overridden fields in subclasses with the super class's field
        fieldsToMarshall.addAll(Arrays.asList(zuper.getDeclaredFields()));
    }

    /* By now, fieldsToMarshall should contain all the fields
     * so it's time to figure out how to access them.
     */
    Method getter, setter;
    Converter converter;
    for (Field field : fieldsToMarshall) {

        int mod = field.getModifiers();
        if (Modifier.isStatic(mod) || Modifier.isFinal(mod)) {
            log.debug("Skipping final or static field " + field.getName());
            continue;
        }

        getter = setter = null;

        // if direct access doesn't work, look for JavaBean
        // getters and setters
        String fieldName = field.getName();
        Class fieldType = field.getType();

        try {
            getter = getGetter(field);
        } catch (NoSuchMethodException nsme) {
            log.debug("Failed to find getter for " + fieldName);
        }

        try {
            setter = getSetter(field);
        } catch (NoSuchMethodException nsme) {
            log.debug("Failed to find setter for " + fieldName);
        }

        if (getter == null && setter == null) {
            // Shit, we didn't figure out how to access it
            log.debug("Could not access field: " + field.getName());
        } else {
            converter = new Converter(getter, setter);

            if (field.isAnnotationPresent(Id.class)) {
                log.debug("Found entityIdFied for " + klass.getName() + ": " + field.getName());
                entityIdField = field;
                embeddedId = false;
            }

            if (field.isAnnotationPresent(EmbeddedId.class)) {
                log.debug("Found embedded entityIdFied for " + klass.getName() + ": " + field.getName());
                entityIdField = field;
                embeddedId = true;
            }

            if (field.isAnnotationPresent(GeneratedValue.class) || setter == null) {
                converter.setReadOnly(true);
            }

            if (field.getType().isAnnotationPresent(Entity.class)) {
                converter.setEntity(fieldType);
            }

            Class superClass = field.getType();
            if (superClass != null) {
                do {
                    if (superClass == Collection.class) {
                        try {
                            Type type = field.getGenericType();
                            String typeString = type.toString();

                            while (typeString.matches("[^<]+?<[^>]+?>"))
                                typeString = typeString.substring(typeString.indexOf("<") + 1,
                                        typeString.indexOf(">"));

                            Class collectionType = Class.forName(typeString);
                            converter.setCollection(collectionType);

                            if (collectionType.getAnnotation(Entity.class) != null)
                                converter.setEntity(collectionType);

                            log.debug(field.getName() + " is entity = " + converter.isEntity());
                            log.debug(field.getName() + " collectionType = "
                                    + converter.getType().getSimpleName());

                        } catch (Exception e) {
                            log.debug("error getting collection type", e);
                        } finally {
                            break;
                        }
                    }
                    superClass = superClass.getSuperclass();
                } while (superClass != null);
            }

            instructions.put(field, converter);
        }
    }
}

From source file:net.firejack.platform.model.service.reverse.ReverseEngineeringService.java

private void analyzeField(String name, Type type, RelationshipType relationshipType, EntityModel entityModel,
        XmlElement element, Map<String, EntityModel> models, List<RelationshipModel> relationships,
        List<FieldModel> fields) {
    if (type instanceof Class) {
        Class clazz = (Class) type;
        boolean required = false;
        if (element != null) {
            required = element.required();
            if (!name.equals(StringUtils.uncapitalize(element.name())) && !"##default".equals(element.name()))
                name = element.name();/*  ww  w . j a v  a  2s  . c  o m*/
        }

        if (clazz.isAnnotationPresent(XmlAccessorType.class)) {
            EntityModel target = createBeanEntity(clazz, entityModel.getParent(), relationships, models);
            RelationshipModel relationshipModel = createRelationship(name, required, entityModel, target,
                    relationshipType);
            relationships.add(relationshipModel);
        } else {
            FieldModel field = createField(name, clazz, required, entityModel);
            fields.add(field);
        }
    } else if (type instanceof ParameterizedType) {
        ParameterizedType parameterizedType = (ParameterizedType) type;
        Type rawType = parameterizedType.getRawType();
        Type generic = parameterizedType.getActualTypeArguments()[0];
        if (rawType == Holder.class) {
            analyzeField(name, generic, relationshipType, entityModel, element, models, relationships, fields);
        } else if (rawType == List.class) {
            if (generic instanceof Class && ((Class) generic).isAnnotationPresent(XmlAccessorType.class)) {
                analyzeField(name, generic, ASSOCIATION, entityModel, element, models, relationships, fields);
            } else {
                analyzeField(name, rawType, relationshipType, entityModel, element, models, relationships,
                        fields);
            }
        } else {
            throw new IllegalStateException("Unknown type: " + type + " entity: " + entityModel.getName());
        }
    }
}

From source file:org.vulpe.model.dao.impl.jpa.AbstractVulpeBaseDAOJPA.java

private String loadRelationshipsMountSelectAndFrom(final Relationship relationship, final String parentName,
        final Class propertyType, final ENTITY firstEntity, final Map<String, String> hqlAttributes,
        final OneToMany oneToMany, final boolean loadAll) {
    final StringBuilder hql = new StringBuilder();
    try {//from w w  w.  j  a v a2s .c  om
        final List<String> hqlJoin = new ArrayList<String>();
        if (oneToMany != null && loadAll) {
            hql.append("select obj ");
        } else {
            hql.append("select new map(obj.id as id");
            for (final String attribute : relationship.attributes()) {
                if ("id".equals(attribute)) {
                    continue;
                }
                if (oneToMany != null) {
                    final Class attributeType = PropertyUtils
                            .getPropertyType(oneToMany.targetEntity().newInstance(), attribute);
                    boolean manyToOne = attributeType.isAnnotationPresent(ManyToOne.class)
                            || VulpeEntity.class.isAssignableFrom(attributeType);
                    hql.append(", ").append("obj.").append(attribute + (manyToOne ? ".id" : "")).append(" as ")
                            .append(attribute);
                } else {
                    if (attribute.contains("[")) {
                        final StringBuilder hqlAttribute = new StringBuilder("select new map(obj.id as id");
                        String attributeParent = attribute.substring(0, attribute.indexOf('['));
                        hqlAttribute.append(loadRelationshipsMountReference(attribute, null));
                        if (StringUtils.isEmpty(attributeParent)) {
                            attributeParent = relationship.property();
                            final Class attributeParentType = PropertyUtils.getPropertyType(firstEntity,
                                    attributeParent);
                            hqlAttribute.append(") from ").append(attributeParentType.getSimpleName())
                                    .append(" obj");
                        } else {
                            final Class attributeParentType = PropertyUtils
                                    .getPropertyType(propertyType.newInstance(), attributeParent);
                            hqlAttribute.append(") from ").append(attributeParentType.getSimpleName())
                                    .append(" obj");
                            int joinCount = hqlJoin.size() + 1;
                            hqlJoin.add((joinCount > 0 ? "" : ",") + "left outer join obj." + attributeParent
                                    + " obj" + joinCount);
                            hql.append(", obj").append(joinCount).append(".id").append(" as ")
                                    .append(attributeParent);
                        }
                        hqlAttribute.append(" where obj.id in (:ids)");
                        hqlAttributes.put(attribute, hqlAttribute.toString());
                    } else {
                        final Class attributeType = PropertyUtils.getPropertyType(propertyType.newInstance(),
                                attribute);
                        boolean manyToOne = attributeType.isAnnotationPresent(ManyToOne.class)
                                || VulpeEntity.class.isAssignableFrom(attributeType);
                        hql.append(", ").append("obj.").append(attribute + (manyToOne ? ".id" : ""))
                                .append(" as ").append(attribute);
                    }
                }
            }
            if (oneToMany != null) {
                hql.append(", obj.").append(parentName).append(".id as ").append(parentName);
            }
            hql.append(")");
        }
        final String className = oneToMany == null ? propertyType.getSimpleName()
                : oneToMany.targetEntity().getSimpleName();
        hql.append(" from ").append(className).append(" obj ");
        for (final String join : hqlJoin) {
            hql.append(join);
        }
    } catch (Exception e) {
        LOG.error(e.getMessage());
    }
    return hql.toString();
}

From source file:org.jobjects.dao.annotation.Manager.java

/**
 * @param entityClass/*  w  w w. ja  v a2  s .  co m*/
 */
public Manager(Class<T> entityClass) {
    this.entityClass = entityClass;
    if (entityClass.isAnnotationPresent(DaoTable.class)) {
        DaoTable daoTable = entityClass.getAnnotation(DaoTable.class);
        if (StringUtils.isBlank(daoTable.schemaName())) {
            usualTable = daoTable.tableName();
        } else {
            usualTable = daoTable.schemaName() + "." + daoTable.tableName();
        }
        dataSourceName = daoTable.dataSourceName();
        fields = entityClass.getDeclaredFields();
    }
}

From source file:com.github.jackygurui.vertxredissonrepository.repository.Impl.RedisRepositoryImpl.java

private boolean isRedisEntity(Class cls) {
    return cls != null && cls.isAnnotationPresent(RedissonEntity.class);
}

From source file:org.alfresco.rest.framework.core.ResourceInspector.java

/**
 * Inspects the relationship resource and returns meta data about it
 * //from  www .  j  a  v  a2s  . com
 * @param annot RelationshipResource
 * @param resource Class<?>
 */
private static List<ResourceMetadata> inspectRelationship(RelationshipResource annot, Class<?> resource) {
    Map<String, Object> annotAttribs = AnnotationUtils.getAnnotationAttributes(annot);
    String urlPath = String.valueOf(annotAttribs.get("name"));
    String entityPath = findEntityNameByAnnotationAttributes(annotAttribs);
    String relationshipKey = ResourceDictionary.resourceKey(entityPath, urlPath);
    Api api = inspectApi(resource);
    List<ResourceMetadata> metainfo = new ArrayList<ResourceMetadata>();

    MetaHelper helper = new MetaHelper(resource);
    findOperation(RelationshipResourceAction.Create.class, HttpMethod.POST, helper);
    findOperation(RelationshipResourceAction.Read.class, HttpMethod.GET, helper);
    findOperation(RelationshipResourceAction.ReadById.class, HttpMethod.GET, helper);
    findOperation(RelationshipResourceAction.Update.class, HttpMethod.PUT, helper);
    findOperation(RelationshipResourceAction.Delete.class, HttpMethod.DELETE, helper);

    findOperation(RelationshipResourceAction.CreateWithResponse.class, HttpMethod.POST, helper);
    findOperation(RelationshipResourceAction.ReadWithResponse.class, HttpMethod.GET, helper);
    findOperation(RelationshipResourceAction.ReadByIdWithResponse.class, HttpMethod.GET, helper);
    findOperation(RelationshipResourceAction.UpdateWithResponse.class, HttpMethod.PUT, helper);
    findOperation(RelationshipResourceAction.DeleteWithResponse.class, HttpMethod.DELETE, helper);

    findOperation(MultiPartRelationshipResourceAction.Create.class, HttpMethod.POST, helper);

    boolean noAuth = resource.isAnnotationPresent(WebApiNoAuth.class);
    if (noAuth) {
        throw new IllegalArgumentException(
                "@WebApiNoAuth should not be on all (relationship resource class) - only on methods: "
                        + urlPath);
    }

    Set<Class<? extends ResourceAction>> apiNoAuth = helper.apiNoAuth;

    if (resource.isAnnotationPresent(WebApiDeleted.class)) {
        metainfo.add(new ResourceMetadata(relationshipKey, RESOURCE_TYPE.RELATIONSHIP, null,
                inspectApi(resource), ALL_RELATIONSHIP_RESOURCE_INTERFACES, apiNoAuth, entityPath));
    } else {
        metainfo.add(new ResourceMetadata(relationshipKey, RESOURCE_TYPE.RELATIONSHIP, helper.operations,
                inspectApi(resource), helper.apiDeleted, apiNoAuth, entityPath));
    }

    inspectAddressedProperties(api, resource, relationshipKey, metainfo);
    inspectOperations(api, resource, relationshipKey, metainfo);
    return metainfo;
}

From source file:cat.albirar.framework.dynabean.impl.DynaBeanDescriptor.java

/**
 * Resolve the item type for an array or collection property. 
 * @param propDesc The property descriptor
 */// w w  w.j a  va 2  s  .  c  o  m
private void resolvePropertyComponentType(DynaBeanPropertyDescriptor propDesc) {
    Type[] t;
    Class<?> propType;

    if (propDesc.isCollection()) {
        if (propDesc.getterMethod != null) {
            t = ((ParameterizedType) propDesc.getterMethod.getGenericReturnType()).getActualTypeArguments();
        } else {
            t = ((ParameterizedType) propDesc.setterMethod.getGenericParameterTypes()[0])
                    .getActualTypeArguments();
        }
        propType = (Class<?>) t[0];
    } else {
        if (propDesc.isArray()) {
            if (propDesc.getterMethod != null) {
                propType = propDesc.getterMethod.getReturnType().getComponentType();
            } else {
                propType = propDesc.setterMethod.getParameterTypes()[0].getComponentType();
            }
        } else {
            propType = propDesc.getPropertyType();
        }
    }
    // Test if propType is a 'dynaBean'
    propDesc.itemType = propType;
    propDesc.itemDynaBean = propType.isAnnotationPresent(DynaBean.class);
}

From source file:edu.ku.brc.specify.tools.datamodelgenerator.DatamodelGenerator.java

/**
 * @param className/*from ww w.  j  a  v  a2 s  .  c  om*/
 * @param tableList
 */
@SuppressWarnings("unchecked")
protected void processCascade(final String className, final List<Table> tableList) {
    //System.out.println(className);
    try {
        Class<?> classObj = Class.forName(packageName + "." + className);

        //Table   table       = null; 
        //String  tableName   = null;

        if (classObj.isAnnotationPresent(javax.persistence.Table.class)) {
            for (Method method : classObj.getMethods()) {
                String methodName = method.getName();
                if (!methodName.startsWith("get")
                        || method.isAnnotationPresent(javax.persistence.Transient.class)) {
                    continue;
                }

                if (method.isAnnotationPresent(javax.persistence.ManyToOne.class)) {
                    if (method.isAnnotationPresent(org.hibernate.annotations.Cascade.class)) {
                        System.out.println("Missing Cascade[" + method.getName() + "]");
                        missing++;
                        removeCascadeRule(classObj, method);
                    }
                }
            }
        }

    } catch (Exception ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(DatamodelGenerator.class, ex);
        ex.printStackTrace();
    }
}