org.apache.myfaces.orchestra.dynaForm.metadata.impl.ejb
Class EjbExtractor

java.lang.Object
  extended by org.apache.myfaces.orchestra.dynaForm.metadata.impl.ejb.EjbExtractor
All Implemented Interfaces:
Extractor
Direct Known Subclasses:
HibernateExtractor

public class EjbExtractor
extends Object
implements Extractor

Extract metadata from ejb3 beans.

This class makes a whole lot of assumptions.

It assumes that if there is a method getFoo(), and a field foo exists on the class then that field is a property.


Nested Class Summary
protected static class EjbExtractor.Context
           
protected static class EjbExtractor.ContextInfo
           
 
Constructor Summary
EjbExtractor()
           
 
Method Summary
protected  boolean checkEmbeddEntity(EjbExtractor.Context context, MetaDataWritable metaData, String name)
          check if we should embedd this entity
protected  String convertMethodName(String name)
          get rid of get/set/is in method names
protected  void create(EjbExtractor.Context context, MetaDataWritable metaData, Class entityClass)
          create the metadata for the given class
protected  void createClassList(List<Class<?>> classes, Class<?> clazz)
          get all super classes needed to be parsed.
protected  String createFullName(EjbExtractor.Context context, String name)
           
protected  Boolean determineAccessByField(Class<?> clazz)
           
protected  void embeddEntity(EjbExtractor.Context context, MetaDataWritable metaData, String name, Class<?> entityType)
          embedd this entity
protected  Field[] getFields(Class<?> entityClass)
           
 void getMetaData(MetaDataWritable metaData, Object entity)
          Implement the Extractor interface.
protected  Method[] getMethods(Class<?> entityClass)
           
protected  boolean hasAnnotationTransient(AccessibleObject accessibleObject)
          skip method/fields annotated with transient
protected  void initFromAnnotations(EjbExtractor.Context context, MetaFieldWritable mdField, AccessibleObject accessibleObject)
          init metadata from annotations
protected  void initFromFields(EjbExtractor.Context context, MetaDataWritable metaData, Field[] fields)
          ejb3 access through fields
protected  void initFromMethods(EjbExtractor.Context context, MetaDataWritable metaData, Method[] methods)
          ejb3 access through methods (properties)
protected  void initFromType(EjbExtractor.Context context, MetaFieldWritable mdField, Class type)
           
protected  boolean processEmbedded(EjbExtractor.Context context, MetaDataWritable metaData, AccessibleObject accessibleObject, String name, Class<?> type)
           
protected  void processField(EjbExtractor.Context context, MetaDataWritable metaData, AccessibleObject accessibleObject, String name, Class<?> type, Boolean canRead, Boolean canWrite)
          process the given field - or ist superclass if it is embedded
protected  void setSpecialFieldDisabled(MetaFieldWritable mdField)
          configure a special fields as disabled.
protected  boolean validModifier(int modifier, boolean isMethod)
          skip method/fields marked as static/transient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EjbExtractor

public EjbExtractor()
Method Detail

getMetaData

public void getMetaData(MetaDataWritable metaData,
                        Object entity)
Implement the Extractor interface.

The entity parameter must be a String containing the fully-qualified name of a java class.

The specified class and its ancestors are inspected for JPA annotations, and

Specified by:
getMetaData in interface Extractor

createClassList

protected void createClassList(List<Class<?>> classes,
                               Class<?> clazz)
get all super classes needed to be parsed.

Populates the classes list with the complete superclass chain of the specified class. At return the first entry added to the list is the furthest ancestor that is NOT Object.class, and the last entry in the list is the clazz parameter itself.


create

protected void create(EjbExtractor.Context context,
                      MetaDataWritable metaData,
                      Class entityClass)
create the metadata for the given class


determineAccessByField

protected Boolean determineAccessByField(Class<?> clazz)

getMethods

protected Method[] getMethods(Class<?> entityClass)

getFields

protected Field[] getFields(Class<?> entityClass)

initFromFields

protected void initFromFields(EjbExtractor.Context context,
                              MetaDataWritable metaData,
                              Field[] fields)
ejb3 access through fields


processField

protected void processField(EjbExtractor.Context context,
                            MetaDataWritable metaData,
                            AccessibleObject accessibleObject,
                            String name,
                            Class<?> type,
                            Boolean canRead,
                            Boolean canWrite)
process the given field - or ist superclass if it is embedded


processEmbedded

protected boolean processEmbedded(EjbExtractor.Context context,
                                  MetaDataWritable metaData,
                                  AccessibleObject accessibleObject,
                                  String name,
                                  Class<?> type)

checkEmbeddEntity

protected boolean checkEmbeddEntity(EjbExtractor.Context context,
                                    MetaDataWritable metaData,
                                    String name)
check if we should embedd this entity


createFullName

protected String createFullName(EjbExtractor.Context context,
                                String name)

embeddEntity

protected void embeddEntity(EjbExtractor.Context context,
                            MetaDataWritable metaData,
                            String name,
                            Class<?> entityType)
embedd this entity


initFromAnnotations

protected void initFromAnnotations(EjbExtractor.Context context,
                                   MetaFieldWritable mdField,
                                   AccessibleObject accessibleObject)
init metadata from annotations


setSpecialFieldDisabled

protected void setSpecialFieldDisabled(MetaFieldWritable mdField)
configure a special fields as disabled. e.g. used for Id, Version, ....


initFromMethods

protected void initFromMethods(EjbExtractor.Context context,
                               MetaDataWritable metaData,
                               Method[] methods)
ejb3 access through methods (properties)


initFromType

protected void initFromType(EjbExtractor.Context context,
                            MetaFieldWritable mdField,
                            Class type)

convertMethodName

protected String convertMethodName(String name)
get rid of get/set/is in method names


hasAnnotationTransient

protected boolean hasAnnotationTransient(AccessibleObject accessibleObject)
skip method/fields annotated with transient


validModifier

protected boolean validModifier(int modifier,
                                boolean isMethod)
skip method/fields marked as static/transient



Copyright © 2012 The Apache Software Foundation. All Rights Reserved.