Package org.apache.tapestry5.ioc.modules
Class TapestryIOCModule
- java.lang.Object
-
- org.apache.tapestry5.ioc.modules.TapestryIOCModule
-
@Marker(Builtin.class) public final class TapestryIOCModule extends Object
Defines the base set of services for the Tapestry IOC container.
-
-
Constructor Summary
Constructors Constructor Description TapestryIOCModule()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
bind(ServiceBinder binder)
static ServiceLifecycleSource
build(Map<String,ServiceLifecycle> configuration)
Provides access to additional service lifecycles.static ParallelExecutor
buildDeferredExecution(int coreSize, int maxSize, int keepAliveMillis, boolean threadPoolEnabled, int queueSize, PerthreadManager perthreadManager, RegistryShutdownHub shutdownHub, ThunkCreator thunkCreator)
static void
contributeRegistryStartup(OrderedConfiguration<Runnable> configuration, PeriodicExecutor periodicExecutor)
static void
provideBasicTypeCoercions(MappedConfiguration<CoercionTuple.Key,CoercionTuple> configuration)
Contributes a set of standard type coercions to theTypeCoercer
service: Object to String Object to Boolean String to Double String to BigDecimal BigDecimal to Double Double to BigDecimal String to BigInteger BigInteger to Long String to Long Long to Byte Long to Short Long to Integer Double to Long Double to Float Float to Double Long to Double String to Boolean ("false" is always false, other non-blank strings are true) Number to Boolean (true if number value is non zero) Null to Boolean (always false) Collection to Boolean (false if empty) Object[] to List primitive[] to List Object to List (by wrapping as a singleton list) String to File String toTimeInterval
TimeInterval
to Long Object to Object[] (wrapping the object as an array) Collection to Object[] (via the toArray() method)Flow
to ListFlow
to Boolean (false if empty)static void
provideJSR10TypeCoercions(MappedConfiguration<CoercionTuple.Key,CoercionTuple> configuration)
Contributes coercions to and from Java Time API (JSR 310) classes.static void
providePerthreadScope(MappedConfiguration<String,ServiceLifecycle> configuration)
Contributes the "perthread" scope.static void
setupDefaultSymbols(MappedConfiguration<String,Object> configuration)
static void
setupObjectProviders(OrderedConfiguration<ObjectProvider> configuration, ServiceOverride serviceOverride)
AnnotationBasedContributions Empty placeholder used to separate annotation-based ObjectProvider contributions (which come before) from non-annotation based (such as ServiceOverride) which come after. Value Supports theValue
annotation Symbol Supports theSymbol
annotations Autobuild Supports theAutobuild
annotation ServiceOverride Allows simple service overrides via theServiceOverride
service (and its configuration)static void
setupStandardSymbolProviders(OrderedConfiguration<SymbolProvider> configuration, SymbolProvider applicationDefaults, SymbolProvider factoryDefaults)
SystemProperties Exposes JVM System properties as symbols (currently case-sensitive) EnvironmentVariables Exposes environment variables as symbols (adding a "env." prefix) ApplicationDefaults Values contributed to @SymbolProvider
@ApplicationDefaults
FactoryDefaults Values contributed to @SymbolProvider
@FactoryDefaults
-
-
-
Constructor Detail
-
TapestryIOCModule
public TapestryIOCModule()
-
-
Method Detail
-
bind
public static void bind(ServiceBinder binder)
-
build
@PreventServiceDecoration public static ServiceLifecycleSource build(Map<String,ServiceLifecycle> configuration)
Provides access to additional service lifecycles. One lifecycle is built in ("singleton") but additional ones are accessed via this service (and its mapped configuration). Only proxiable services (those with explicit service interfaces) can be managed in terms of a lifecycle.
-
providePerthreadScope
@Contribute(ServiceLifecycleSource.class) public static void providePerthreadScope(MappedConfiguration<String,ServiceLifecycle> configuration)
Contributes the "perthread" scope.
-
setupObjectProviders
@Contribute(MasterObjectProvider.class) public static void setupObjectProviders(OrderedConfiguration<ObjectProvider> configuration, @Local ServiceOverride serviceOverride)
- AnnotationBasedContributions
- Empty placeholder used to separate annotation-based ObjectProvider contributions (which come before) from non-annotation based (such as ServiceOverride) which come after.
- Value
- Supports the
Value
annotation - Symbol
- Supports the
Symbol
annotations - Autobuild
- Supports the
Autobuild
annotation - ServiceOverride
- Allows simple service overrides via the
ServiceOverride
service (and its configuration)
-
provideBasicTypeCoercions
@Contribute(TypeCoercer.class) public static void provideBasicTypeCoercions(MappedConfiguration<CoercionTuple.Key,CoercionTuple> configuration)
Contributes a set of standard type coercions to theTypeCoercer
service:- Object to String
- Object to Boolean
- String to Double
- String to BigDecimal
- BigDecimal to Double
- Double to BigDecimal
- String to BigInteger
- BigInteger to Long
- String to Long
- Long to Byte
- Long to Short
- Long to Integer
- Double to Long
- Double to Float
- Float to Double
- Long to Double
- String to Boolean ("false" is always false, other non-blank strings are true)
- Number to Boolean (true if number value is non zero)
- Null to Boolean (always false)
- Collection to Boolean (false if empty)
- Object[] to List
- primitive[] to List
- Object to List (by wrapping as a singleton list)
- String to File
- String to
TimeInterval
TimeInterval
to Long- Object to Object[] (wrapping the object as an array)
- Collection to Object[] (via the toArray() method)
Flow
to ListFlow
to Boolean (false if empty)
-
provideJSR10TypeCoercions
@Contribute(TypeCoercer.class) public static void provideJSR10TypeCoercions(MappedConfiguration<CoercionTuple.Key,CoercionTuple> configuration)
Contributes coercions to and from Java Time API (JSR 310) classes.- java.time.Year to Integer
- Integer to java.time.Year
- java.time.Month to Integer
- Integer to Java.time.Month
- java.time.Month to String
- String to java.time.Month
- String to java.time.YearMonth
- java.time.YearMonth to java.time.Year
- java.time.YearMonth to java.time.Month
- String to java.time.MonthDay
- java.time.MonthDay to java.time.Month
- java.time.DayOfWeek to Integer
- Integer to java.time.DayOfWeek
- java.time.DayOfWeek to String
- String to java.time.DayOfWeek
- java.time.LocalDate to java.time.Instant
- java.time.Instant to java.time.LocalDate
- String to java.time.LocalDate
- java.time.LocalDate to java.time.YearMonth
- java.time.LocalDate to java.time.MonthDay
- java.time.LocalTime to Long
- Long to java.time.LocalTime
- String to java.time.LocalDateTime
- java.time.LocalDateTime to java.time.Instant
- java.time.Instant to LocalDateTime
- java.time.LocalDateTime to java.time.LocalDate
- String to java.time.OffsetDateTime
- java.time.OffsetDateTime to java.time.Instant
- java.time.Instant to java.time.OffsetDateTime
- String to java.time.ZoneId
- String to java.time.ZoneOffset
- String to java.time.ZonedDateTime
- java.time.ZonedDateTime to java.time.Instant
- java.time.ZonedDateTime to java.time.ZoneId
- java.time.Instant to Long
- Long to java.time.Instant
- java.time.Instant to java.util.Date
- java.util.Date to java.time.Instant
- java.time.Duration to Long
- Long to java.time.Duration
- String to java.time.Period
-
setupStandardSymbolProviders
@Contribute(SymbolSource.class) public static void setupStandardSymbolProviders(OrderedConfiguration<SymbolProvider> configuration, @ApplicationDefaults SymbolProvider applicationDefaults, @FactoryDefaults SymbolProvider factoryDefaults)
- SystemProperties
- Exposes JVM System properties as symbols (currently case-sensitive)
- EnvironmentVariables
- Exposes environment variables as symbols (adding a "env." prefix)
- ApplicationDefaults
- Values contributed to @
SymbolProvider
@ApplicationDefaults
- FactoryDefaults
- Values contributed to @
SymbolProvider
@FactoryDefaults
-
buildDeferredExecution
public static ParallelExecutor buildDeferredExecution(@Symbol("tapestry.thread-pool.core-pool-size") int coreSize, @Symbol("tapestry.thread-pool.max-pool-size") int maxSize, @Symbol("tapestry.thread-pool.keep-alive") @IntermediateType(TimeInterval.class) int keepAliveMillis, @Symbol("tapestry.thread-pool-enabled") boolean threadPoolEnabled, @Symbol("tapestry.thread-pool.queue-size") int queueSize, PerthreadManager perthreadManager, RegistryShutdownHub shutdownHub, ThunkCreator thunkCreator)
-
setupDefaultSymbols
@Contribute(SymbolProvider.class) @FactoryDefaults public static void setupDefaultSymbols(MappedConfiguration<String,Object> configuration)
-
contributeRegistryStartup
public static void contributeRegistryStartup(OrderedConfiguration<Runnable> configuration, PeriodicExecutor periodicExecutor)
-
-