org.eclipse.jst.jsf.designtime.symbols
Class JSFSymbolFactory

java.lang.Object
  extended by org.eclipse.jst.jsf.context.symbol.InitializedSymbolFactory
      extended by org.eclipse.jst.jsf.designtime.symbols.JSFSymbolFactory

public final class JSFSymbolFactory
extends InitializedSymbolFactory

Factory for creating symbols for variables/message bundles that are contributed by components/tags. This Factory can be used by descendants of AbstractContextSymbolFactory in order to create the symbols they want to contribute. It provides also methods for getting the resulting ValueType from an EL expression and the "row" type signature from an DataModel/Array/List ValueType. NOTE: C.B March 26, 2008 -- commented out portions are left for the future because the rely on enhancements to the symbol model that could not be made in the current release. Other portions of the original ComponentSymbolFactory have been moved to InitializedSymbolFactory This reflects the split between things deemed to be generic EL (put in common plugin) and things deemed to be JSF-specific (put here).


Constructor Summary
JSFSymbolFactory()
           
 
Method Summary
 ISymbol createArraySymbol(java.lang.String symbolName, java.lang.String signature, ERuntimeSource source, IJavaProject javaProject)
           
 ISymbol createDefaultSymbol(java.lang.String symbolName, ERuntimeSource source, java.lang.String description)
           
 ISymbol createFromList(java.lang.String symbolName, org.eclipse.jst.jsf.common.internal.types.ValueType valueType, ERuntimeSource source, java.lang.String description, IJavaProject javaProject)
           
 IBeanInstanceSymbol createManagedBeanSymbol(java.lang.String symbolName, java.lang.String fullyQualifiedName, ERuntimeSource source, java.lang.String description, IJavaProject javaProject)
          FUTURE use: added to support future API feature.
 IInstanceSymbol createMessageBundleSymbol(java.lang.String symbolName, java.lang.String bundleName, IJavaProject project)
          FUTURE use: added to support future API feature.
 ISymbol createScalarSymbol(java.lang.String symbolName, java.lang.String signature, ERuntimeSource source, IJavaProject javaProject)
           
 java.lang.String getRowSignatureFromDataModel(org.eclipse.jst.jsf.common.internal.types.ValueType type)
          Tries to guess the row type of a javax.faces.DataModel instance.
 java.lang.String getRowSignatureFromValueType(org.eclipse.jst.jsf.common.internal.types.ValueType type)
           
 org.eclipse.jst.jsf.common.internal.types.ValueType getValueTypeFromEL(java.lang.String elText, IStructuredDocumentContext elContext, IFile file)
          Convenience for getValueTypeFromEL(String, IStructuredDocumentContext, IFile, IStructuredDocumentSymbolResolverFactory) using StructuredDocumentSymbolResolverFactory.getInstance().
 org.eclipse.jst.jsf.common.internal.types.ValueType getValueTypeFromEL(java.lang.String elText, IStructuredDocumentContext elContext, IFile file, IStructuredDocumentSymbolResolverFactory symbolResolverFactory)
           
 boolean isContainerType(org.eclipse.jst.jsf.common.internal.types.ValueType type)
           
 
Methods inherited from class org.eclipse.jst.jsf.context.symbol.InitializedSymbolFactory
createBeanOrUnknownInstanceSymbol, createJavaComponentSymbol, createJavaComponentSymbol, createTypeDescriptorFromSignature, createUnknownComponentSymbol, createUnknownInstanceSymbol, getElementSignatureFromContainerType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSFSymbolFactory

public JSFSymbolFactory()
Method Detail

getValueTypeFromEL

public org.eclipse.jst.jsf.common.internal.types.ValueType getValueTypeFromEL(java.lang.String elText,
                                                                              IStructuredDocumentContext elContext,
                                                                              IFile file,
                                                                              IStructuredDocumentSymbolResolverFactory symbolResolverFactory)
Parameters:
elText - The EL expression text. Must not be null
elContext - The document context pointing to elText in the source document. Must not be null
file - The workspace resource that contains elText. Must not be null.
symbolResolverFactory -
Returns:
the value expression resolved from elText or null if it cannot be resolved or elText doesn't resolve to value expression (i.e. is a method expression)

getValueTypeFromEL

public org.eclipse.jst.jsf.common.internal.types.ValueType getValueTypeFromEL(java.lang.String elText,
                                                                              IStructuredDocumentContext elContext,
                                                                              IFile file)
Convenience for getValueTypeFromEL(String, IStructuredDocumentContext, IFile, IStructuredDocumentSymbolResolverFactory) using StructuredDocumentSymbolResolverFactory.getInstance().

Parameters:
elText -
elContext -
file -
Returns:
a ValueType or null

getRowSignatureFromDataModel

public java.lang.String getRowSignatureFromDataModel(org.eclipse.jst.jsf.common.internal.types.ValueType type)
Tries to guess the row type of a javax.faces.DataModel instance. This will only work if type is a descendant that narrows down the return type of "getRowData()".

Parameters:
type -
Returns:
the row type of the given DataModel. Will return null if type is no DataModel or if nothing more specific than Object can be determined

isContainerType

public boolean isContainerType(org.eclipse.jst.jsf.common.internal.types.ValueType type)
Parameters:
type -
Returns:
true, if type is a collection or array

getRowSignatureFromValueType

public java.lang.String getRowSignatureFromValueType(org.eclipse.jst.jsf.common.internal.types.ValueType type)
Parameters:
type - - the type of the value property
Returns:
the type signature of the row variable for every type that UIData takes as value property. Will return null if no type or nothing more specific than Object can be determined

createArraySymbol

public final ISymbol createArraySymbol(java.lang.String symbolName,
                                       java.lang.String signature,
                                       ERuntimeSource source,
                                       IJavaProject javaProject)
Parameters:
symbolName - The name of the symbol to be created. Must not be null
signature - The type signature of the array type. Must not be null
source - the runtime source
javaProject - must not be null
Returns:
a symbol based approximating an implicit DataModel wrapper for an array

createScalarSymbol

public final ISymbol createScalarSymbol(java.lang.String symbolName,
                                        java.lang.String signature,
                                        ERuntimeSource source,
                                        IJavaProject javaProject)
Parameters:
symbolName - The name of the symbol to create. Must not be null.
signature - The fully resolved type signature of the scalar. Must not be null.
source -
javaProject - The JavaProject whose classpath is to be used to resolve type information for signture. Must not be null.
Returns:
a symbol approximating a scalar object DataModel wrapper. The row variable for the data model becomes of type signature

createFromList

public final ISymbol createFromList(java.lang.String symbolName,
                                    org.eclipse.jst.jsf.common.internal.types.ValueType valueType,
                                    ERuntimeSource source,
                                    java.lang.String description,
                                    IJavaProject javaProject)
Parameters:
symbolName - The name of the symbol to create. Must not be null.
valueType - The value expression representing the implicit list. The signature on the valueType must be a list. Must not be null.
source -
description -
javaProject - The JavaProject whose classpath will be used to resolve types. Must not be null.
Returns:
a symbol that approximates as best as possible an implicit DataModel for java.util.List value expressions. If the List has resolvable Java 5 type arguments, then a scalar symbol will be created using this type information. If it is a raw type, then createDefaultSymbol() is called

createDefaultSymbol

public final ISymbol createDefaultSymbol(java.lang.String symbolName,
                                         ERuntimeSource source,
                                         java.lang.String description)
Parameters:
symbolName - The name of the symbol to create. Must not be null
source -
description -
Returns:
a default symbol that eliminates bogus warnings for this dataTable's row variable in cases where something better is resolvable. Note that this is not ideal, since will result in any property being accepted on the variable with this name.

createMessageBundleSymbol

public IInstanceSymbol createMessageBundleSymbol(java.lang.String symbolName,
                                                 java.lang.String bundleName,
                                                 IJavaProject project)
FUTURE use: added to support future API feature. Should not be used.

Parameters:
symbolName -
bundleName -
project -
Returns:
an instance symbol for the message bundle

createManagedBeanSymbol

public IBeanInstanceSymbol createManagedBeanSymbol(java.lang.String symbolName,
                                                   java.lang.String fullyQualifiedName,
                                                   ERuntimeSource source,
                                                   java.lang.String description,
                                                   IJavaProject javaProject)
FUTURE use: added to support future API feature. Should not be used.

Parameters:
symbolName -
fullyQualifiedName -
source -
description -
javaProject -
Returns:
an instance symbol for the message bundle