Top Description Inners Fields Constructors Methods
org.glassfish.hk2.classmodel.reflect

public Class ParsingContext

extends Object
Class Inheritance
Imports
org.glassfish.hk2.classmodel.reflect.impl.ModelClassVisitor, .TypeBuilder, .TypesCtr, .TypesImpl, org.glassfish.hk2.classmodel.reflect.util.CommonModelRegistry, .ParsingConfig, .ResourceLocator, org.objectweb.asm.ClassVisitor, java.util.Collections, .HashMap, .Map, .Set, java.util.concurrent.ExecutorService, java.util.concurrent.locks.ReentrantLock, java.net.URI, java.util.logging.Logger

Parsing context for parsing jars and directories and getting a classmodel back
Author
Jerome Dochez

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ParsingContext.Builder

Context builder

Field Summary

Modifier and TypeField and Description
pack-priv final ArchiveSelector
pack-priv Map<URI, TypeBuilder>
pack-priv final ParsingConfig
pack-priv final ExecutorService
pack-priv final ResourceLocator
pack-priv final ReentrantLock
pack-priv final Logger
pack-priv final TypesCtr

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ClassVisitor
getClassVisitor(URI uri, String entryName)

public ClassVisitor
getClassVisitor(URI uri, String entryName, boolean isApplicationClass)

public ParsingConfig
public ResourceLocator
public TypeBuilder
getTypeBuilder(URI definingURI)

public Types

Returns:

the visited types.
getTypes
()

Return the holder instance of all the visited types.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

archiveSelectorback to summary
pack-priv final ArchiveSelector archiveSelector
buildersback to summary
pack-priv Map<URI, TypeBuilder> builders
configback to summary
pack-priv final ParsingConfig config
executorServiceback to summary
pack-priv final ExecutorService executorService
locatorback to summary
pack-priv final ResourceLocator locator
lockback to summary
pack-priv final ReentrantLock lock
loggerback to summary
pack-priv final Logger logger
typesback to summary
pack-priv final TypesCtr types

Constructor Detail

ParsingContextback to summary
private ParsingContext(ParsingContext.Builder builder)

Method Detail

getClassVisitorback to summary
public ClassVisitor getClassVisitor(URI uri, String entryName)
getClassVisitorback to summary
public ClassVisitor getClassVisitor(URI uri, String entryName, boolean isApplicationClass)
getConfigback to summary
public ParsingConfig getConfig()
getLocatorback to summary
public ResourceLocator getLocator()
getTypeBuilderback to summary
public TypeBuilder getTypeBuilder(URI definingURI)
getTypesback to summary
public Types getTypes()

Return the holder instance of all the visited types. This should only be called once the org.glassfish.hk2.classmodel.reflect.Parser#awaitTermination() has returned.

Returns:Types

the visited types.

org.glassfish.hk2.classmodel.reflect back to summary

public Class ParsingContext.Builder

extends Object
Class Inheritance

Context builder

Field Summary

Modifier and TypeField and Description
pack-priv ArchiveSelector
pack-priv ParsingConfig
pack-priv ExecutorService
pack-priv ResourceLocator
pack-priv Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ParsingContext.Builder

Returns:

itself
archiveSelector
(ArchiveSelector
the archive selector.
selector
)

Sets the archive selector that can selects which jar should be parsed during the parsing activity.

public ParsingContext

Returns:

the @{link ParsingContext} instance
build
()

Build the final ParsingContext with the provided configuration.

public ParsingContext.Builder

Returns:

itself
config
(ParsingConfig
the config instance
config
)

Sets the parsing config that can be used to select which types should be exhaustively visited (fields + methods visits) or not.

public ParsingContext.Builder

Returns:

itself
executorService
(ExecutorService
the executor service to be used during the parsing activity
service
)

Sets the executor service to be used to spawn threads during the parsing activity.

public ParsingContext.Builder

Returns:

itself
locator
(ResourceLocator
a resource locator instance
locator
)

Sets the resource locator that can be used to load and parse extra types that were referenced during the parsing but could not be parsed due to their absence from the input archive set.

public Logger

Returns:

the current logger associated with this builder, either set using logger(java.util.logging.Logger) method, either using the default logger for this library.
logger
()

Returns the configured or default logger for the class-model library.

public ParsingContext.Builder

Returns:

itself
logger
(Logger
a logger instance
logger
)

Sets the logger to be used during the parsing activity.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

archiveSelectorback to summary
pack-priv ArchiveSelector archiveSelector
configback to summary
pack-priv ParsingConfig config
executorServiceback to summary
pack-priv ExecutorService executorService
locatorback to summary
pack-priv ResourceLocator locator
loggerback to summary
pack-priv Logger logger

Constructor Detail

Builderback to summary
public Builder()

Method Detail

archiveSelectorback to summary
public ParsingContext.Builder archiveSelector(ArchiveSelector selector)

Sets the archive selector that can selects which jar should be parsed during the parsing activity. This is particularly useful when the parser is configured to parse an entire directory of jars but only needs to actually parse those jars depending on some environmental condition or if the jar shows a particular stigma (like a jar entry existence).

Parameters
selector:ArchiveSelector

the archive selector.

Returns:ParsingContext.Builder

itself

buildback to summary
public ParsingContext build()

Build the final ParsingContext with the provided configuration.

Returns:ParsingContext

the @{link ParsingContext} instance

configback to summary
public ParsingContext.Builder config(ParsingConfig config)

Sets the parsing config that can be used to select which types should be exhaustively visited (fields + methods visits) or not.

Parameters
config:ParsingConfig

the config instance

Returns:ParsingContext.Builder

itself

executorServiceback to summary
public ParsingContext.Builder executorService(ExecutorService service)

Sets the executor service to be used to spawn threads during the parsing activity. The parsing activity is an asynchronous process that can choose to spawn threads to handle sub part of the handling process.

Parameters
service:ExecutorService

the executor service to be used during the parsing activity

Returns:ParsingContext.Builder

itself

locatorback to summary
public ParsingContext.Builder locator(ResourceLocator locator)

Sets the resource locator that can be used to load and parse extra types that were referenced during the parsing but could not be parsed due to their absence from the input archive set. The parser will call the ResourceLocator to give a chance to the caller to selectively add such unvisited types to the parsing activity

Parameters
locator:ResourceLocator

a resource locator instance

Returns:ParsingContext.Builder

itself

loggerback to summary
public Logger logger()

Returns the configured or default logger for the class-model library.

Returns:Logger

the current logger associated with this builder, either set using logger(java.util.logging.Logger) method, either using the default logger for this library.

loggerback to summary
public ParsingContext.Builder logger(Logger logger)

Sets the logger to be used during the parsing activity.

Parameters
logger:Logger

a logger instance

Returns:ParsingContext.Builder

itself