java.lang.Object
de.grogra.pf.io.FilterBase
de.grogra.rgg.model.XLFilter
- All Implemented Interfaces:
Filter
,FilterSource
,ObjectSource
,RegistryContext
,Map
- Direct Known Subclasses:
JavaFilter
,LSYFilter
,RGGFilter
An
XLFilter
parses a character stream representing XL source
code into a CompilationUnit
. The auxiliary method
compile()
automatically compiles the resulting compilation unit
into the contained types.- Author:
- Ole Kniemeyer
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.grogra.pf.io.FilterSource
FilterSource.MetaDataKey<V>
-
Field Summary
Fields inherited from class de.grogra.pf.io.FilterBase
item, source
Fields inherited from interface de.grogra.pf.io.FilterSource
AUTO_PROGRESS, DESTINATION_FILE, DESTINATION_URL
Fields inherited from interface de.grogra.util.Map
DEFAULT_VALUE, EMPTY_MAP
-
Constructor Summary
ConstructorDescriptionXLFilter
(FilterItem item, ReaderSource source) Constructs a new filter which transforms the inputsource
into an instance ofCompilationUnit
which can be compiled afterwards. -
Method Summary
Modifier and TypeMethodDescriptionType[]
compile()
Compiles the source of this filter into an array of the types which are declared by the source.static Type[]
This auxiliary method compiles the source code ofinput
to an array of typesprotected Parser
Creates the parser which will subsequently be used to parse the token stream resulting fromt
into an abstract syntax tree.protected Tokenizer
Creates the tokenizer to be used for scanning of the source.protected String
Derives a legal class name from the sytem id of the source.protected ObjectList<Annotation>
protected Scope
getImports
(ClassPath path) Constructs the scope which includes all automatic imports.static ASMTypeLoader
static ASMTypeLoader
protected Class[]
Defines the automatic member type imports (e.g.,import java.awt.PageAttributes
Returns the data as an object of a class which is compatible which the flavor.protected String[]
Defines the automatic package imports (e.g.,import java.lang
protected Class[]
Defines the automatic single type imports (e.g.,import java.util.Map;
).protected Class[]
Defines the automatic static type imports (e.g.,import static java.lang.Math
protected boolean
Defines whether the conversion fromdouble
tofloat
should be considered as widening, i.e., should be done automatically if required.Methods inherited from class de.grogra.pf.io.FilterBase
get, getFilter, getFlavor, getImpl, getMetaData, getRegistry, getSource, getSystemId, initProgressMonitor, setFlavor, setMetaData, setMetaData, setProgress, setSystemId, toString, toURL
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface de.grogra.pf.io.FilterSource
getFilter, getFlavor, getMetaData, getSystemId, initProgressMonitor, setMetaData, setProgress
Methods inherited from interface de.grogra.pf.registry.RegistryContext
getRegistry
-
Field Details
-
DUMP_TREE
public static boolean DUMP_TREE
-
-
Constructor Details
-
XLFilter
Constructs a new filter which transforms the inputsource
into an instance ofCompilationUnit
which can be compiled afterwards.- Parameters:
item
- the defining item for this filter within the registry, may benull
source
- the source from which the input stream of characters will be read- See Also:
-
-
Method Details
-
getClassName
Derives a legal class name from the sytem id of the source. May be used in subclasses which implicitly generate such a class name.- Returns:
- class name derived from system id of the source
-
createTokenizer
Creates the tokenizer to be used for scanning of the source.- Returns:
- tokenizer instance
-
createParser
Creates the parser which will subsequently be used to parse the token stream resulting fromt
into an abstract syntax tree.- Parameters:
t
- token stream input- Returns:
- parser which parses token stream of
t
-
getPackageImports
Defines the automatic package imports (e.g.,import java.lang.*;
). The implementation ofXLFilter
returns{"java.lang"}
.- Returns:
- automatic package imports
-
getMemberTypeImports
Defines the automatic member type imports (e.g.,import java.awt.PageAttributes.*;
).- Returns:
- types whose member types are imported automatically
-
getSingleTypeImports
Defines the automatic single type imports (e.g.,import java.util.Map;
).- Returns:
- types which are imported automatically
- Throws:
ClassNotFoundException
-
getStaticTypeImports
Defines the automatic static type imports (e.g.,import static java.lang.Math.*;
).- Returns:
- types whose static members are imported automatically
- Throws:
ClassNotFoundException
-
getEnclosingAnnotations
-
isD2FWidening
protected boolean isD2FWidening()Defines whether the conversion fromdouble
tofloat
should be considered as widening, i.e., should be done automatically if required.- Returns:
- implicit conversion from
double
tofloat
?
-
getLoaderForRegistry
-
getImports
Constructs the scope which includes all automatic imports.- Parameters:
path
- class path which defines the existing classes and interfaces- Returns:
- scope including automatic imports based on
path
- Throws:
ClassNotFoundException
- See Also:
-
getObject
Description copied from interface:ObjectSource
Returns the data as an object of a class which is compatible which the flavor.- Specified by:
getObject
in interfaceObjectSource
- Returns:
- the data
- Throws:
IOException
-
compile
Compiles the source of this filter into an array of the types which are declared by the source. This included top-level types, nested types, and local and anonymous classes. The returned types are wrappers for trueClass
objects, i.e., they represent true classes loaded by the Java virtual machine.- Returns:
- array of compiled, declared types of the source code
- Throws:
IOException
- if source cannot be read or if there is a lexical, syntactic or semantic error
-
compile
This auxiliary method compiles the source code ofinput
to an array of types- Parameters:
input
-systemId
-- Returns:
- array of compiled, declared types of the source code
- Throws:
IOException
- if source cannot be read or if there is a lexical, syntactic or semantic error- See Also:
-
getLoaderForAll
-