org.jvnet.hk2.component.classmodel
Class InhabitantsParsingContextGenerator

java.lang.Object
  extended by org.jvnet.hk2.component.classmodel.InhabitantsParsingContextGenerator
All Implemented Interfaces:
java.io.Closeable

public abstract class InhabitantsParsingContextGenerator
extends java.lang.Object
implements java.io.Closeable

Responsible for generating the collection of inhabitants, decoupling from implementation detail for the caller.

The caller is expected to continually build up the InhabitantsGenerator context by calling add*(), followed by calling getModelInhabitants() to obtain the progenitors of the inhabitants.

There are two ways to close this instance, either through getContext() or through calling close() directly.

Since:
3.1
Author:
Jerome Dochez, Jeff Trent

Constructor Summary
protected InhabitantsParsingContextGenerator(java.util.concurrent.ExecutorService es, ClassPath inhabitantsClassPath)
           
 
Method Summary
protected  void addInhabitantsScanner(java.lang.String name, InhabitantsScanner is)
           
 void close()
           
static InhabitantsParsingContextGenerator create(Habitat h)
          Factory for the InhabitantsParsingContextGenerator
static InhabitantsParsingContextGenerator create(Habitat h, java.util.concurrent.ExecutorService es, ClassPath inhabitantsClassPath)
          Factory for the InhabitantsParsingContextGenerator
 org.glassfish.hk2.classmodel.reflect.ParsingContext getContext()
          Retrieves the parsing context that can be used for model generation elsewhere.
 java.util.Collection<InhabitantsScanner> getInhabitantsScanners()
           
 void parse(java.util.Collection<java.io.File> files)
          Add the collection of files to the current InhabitantsGenerator context.
 void parse(java.io.File f)
          Eventually we can perform optimizations here instead of a pass-thru to parseAlways.
protected  void parseAlways(org.glassfish.hk2.classmodel.reflect.Parser parser, java.io.File f)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InhabitantsParsingContextGenerator

protected InhabitantsParsingContextGenerator(java.util.concurrent.ExecutorService es,
                                             ClassPath inhabitantsClassPath)
Method Detail

create

public static InhabitantsParsingContextGenerator create(Habitat h)
Factory for the InhabitantsParsingContextGenerator

Parameters:
h - habitat not currently used; reserved for future use
Returns:
an empty context InhabitantsGenerator

create

public static InhabitantsParsingContextGenerator create(Habitat h,
                                                        java.util.concurrent.ExecutorService es,
                                                        ClassPath inhabitantsClassPath)
Factory for the InhabitantsParsingContextGenerator

Parameters:
h - habitat not currently used; reserved for future use
es - the executor to use for any async processing (e.g., parsing)
inhabitantsClassPath - the fully qualified classpath in order to resolve class-model
Returns:
an empty context InhabitantsGenerator

parse

public void parse(java.util.Collection<java.io.File> files)
           throws java.io.IOException
Add the collection of files to the current InhabitantsGenerator context.

Parameters:
files - the files to parse.
Throws:
java.io.IOException

getContext

public org.glassfish.hk2.classmodel.reflect.ParsingContext getContext()
Retrieves the parsing context that can be used for model generation elsewhere. Note that this can be called at most once and then this instance is implicitly closed.

Returns:
the parsing context given the code sources provided

getInhabitantsScanners

public java.util.Collection<InhabitantsScanner> getInhabitantsScanners()
Returns:
the collection of InhabitantsScanners being maintained

addInhabitantsScanner

protected void addInhabitantsScanner(java.lang.String name,
                                     InhabitantsScanner is)

parse

public void parse(java.io.File f)
           throws java.io.IOException
Eventually we can perform optimizations here instead of a pass-thru to parseAlways.

Throws:
java.io.IOException

parseAlways

protected void parseAlways(org.glassfish.hk2.classmodel.reflect.Parser parser,
                           java.io.File f)
                    throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
Specified by:
close in interface java.io.Closeable


Copyright © 2010 Oracle Corporation. All Rights Reserved.