|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openide.compiler.Compiler
Implementable object representing one task of compilation.
A module's implementation should typically be instantiated within
an implementation of CompilerCookie.addToJob(org.openide.compiler.CompilerJob, org.openide.compiler.Compiler.Depth)
,
or (preferably) CompilerType.prepareJob(org.openide.compiler.CompilerJob, java.lang.Class, org.openide.loaders.DataObject)
.
It need not do much beyond keep track of the particular file (data object, ...)
it is associated with and make sure the associated CompilerGroup
implementation
knows about it (via CompilerGroup.add(org.openide.compiler.Compiler)
).
Important: Each compiler should implement equals (Object)
and
hashCode ()
methods
to work correctly. That means to check whether the file (data object, ...) that
should be compiled is the same or not. Two Compilers should be equal even
if they have different set of dependencies, they do not matter. hashCode ()
must be consistent with equals (Object)
.
Inner Class Summary | |
static class |
Compiler.Depth
Depth of compilation. |
Field Summary | |
static Compiler.Depth |
DEPTH_INFINITE
Infinite level of compilation--compile all folders recursively. |
static Compiler.Depth |
DEPTH_ONE
Penultimate level of compilation--folder should compile just directly contained files, but not recursively. |
static Compiler.Depth |
DEPTH_ZERO
Zero level of compilation--leaves should compile themself, but folders should do nothing. |
Fields inherited from interface org.openide.compiler.Compilable |
MUTEX |
Constructor Summary | |
Compiler()
Default constructor. |
|
Compiler(Compiler c)
Deprecated. use new Compiler ().dependsOn (c); |
|
Compiler(Compiler[] dep)
Deprecated. use new Compiler ().dependsOn (Arrays.asList (dep)); |
|
Compiler(CompilerJob job)
Deprecated. use job.add (new Compiler ()); |
Method Summary | |
abstract Class |
compilerGroupClass()
Get the associated CompilerGroup container class. |
Object |
compilerGroupKey()
Specify a unique key permitting division of a set of compilers into different compiler groups. |
Collection |
compilers()
Returns itself. |
Collection |
dependsOn()
A collection of other Compilable objects that have to be finished before the compilers of this Compilable can be started. |
void |
dependsOn(Collection compilables)
Add dependency on a compilable object. |
void |
dependsOn(Compilable compilable)
Add dependency on a compilable object. |
protected abstract boolean |
isUpToDate()
Check whether the compiler is up to date. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.openide.compiler.Compilable |
equals |
Field Detail |
public static final Compiler.Depth DEPTH_ZERO
public static final Compiler.Depth DEPTH_ONE
public static final Compiler.Depth DEPTH_INFINITE
Constructor Detail |
public Compiler()
public Compiler(CompilerJob job)
job
- the job the compiler belongs topublic Compiler(Compiler c)
c
- the compiler to depend onpublic Compiler(Compiler[] dep)
dep
- compilers to depend onMethod Detail |
protected abstract boolean isUpToDate()
CompilerJob.isUpToDate()
to skip a compilation when it is unnecessary.true
if up-to-date; false
if compilation is neededpublic abstract Class compilerGroupClass()
CompilerGroup
container class.
The compiler and compiler group should typically be implemented in parallel,
though it is possible to subclass a compiler without subclassing the compiler group.
The compiler group must be "expecting" a compiler of this class (or a superclass), or else
it is free to fail in an unspecified way.
All instances of the same compiler class must return the same result from this method.CompilerGroup
public Object compilerGroupKey()
CompilationEngine.createCompilerGroups(java.util.Collection)
, will always separate
compilers within a given job into levels based on their stated dependencies; however, it will
also split compilers into different groups within each level, based on this key. All compilers
with the same key which can fit into the same level will be placed into a single group.
No group will contain compilers with different values of the key.
This key should only be used for grouping; it is not available to the compiler group, as
its content may be idiosyncratic. (Compiler groups requiring specific pieces of information
from the compilers added to them must extract this information according to accessible methods
or fields of the compilers, as they are added
.) The key must obey
the general Java language contract for object comparison, according to Object.equals(java.lang.Object)
and Object.hashCode()
.
By default, only the compilerGroupClass()
is used. It is required that each compiler
class, if it needs to override this method, first call the super method and add distinctions to
this result. I.e. a subclass may never produce a key less discriminating than the superclass.
The suggested implementation is to call the super method, and then return a List
containing both the super's result, as well as any information added
by this subclass.
Additionally, in the unusual but possible case that a compiler is subclassing another
compiler, while still using the same compiler group class as its superclass, the subclass compiler must
include in the key (e.g. an additional vector element) the class object for the subclass (determined via a static class
constant, not Object.getClass()
!)--this will ensure that keys from unrelated subclasses of the
same compiler superclass will not randomly conflict.
public final void dependsOn(Compilable compilable)
compilable
- any compilable object (Compiler, CompilerJob, etc.)public void dependsOn(Collection compilables)
compilables
- collection of Compilablepublic final Collection compilers()
compilers
in interface Compilable
public final Collection dependsOn()
dependsOn
in interface Compilable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |