Package com.helger.xml.schema
Class SchemaCache
java.lang.Object
com.helger.commons.cache.MappedCache<com.helger.commons.collection.impl.ICommonsList<? extends com.helger.commons.io.resource.IReadableResource>,com.helger.commons.collection.impl.ICommonsList<? extends com.helger.commons.io.resource.IReadableResource>,Schema>
com.helger.commons.cache.Cache<com.helger.commons.collection.impl.ICommonsList<? extends com.helger.commons.io.resource.IReadableResource>,Schema>
com.helger.xml.schema.SchemaCache
- All Implemented Interfaces:
com.helger.commons.cache.ICache<com.helger.commons.collection.impl.ICommonsList<? extends com.helger.commons.io.resource.IReadableResource>,,Schema> com.helger.commons.cache.IMutableCache<com.helger.commons.collection.impl.ICommonsList<? extends com.helger.commons.io.resource.IReadableResource>,,Schema> com.helger.commons.lang.IHasSize,com.helger.commons.name.IHasName
- Direct Known Subclasses:
XMLSchemaCache
@ThreadSafe
public class SchemaCache
extends com.helger.commons.cache.Cache<com.helger.commons.collection.impl.ICommonsList<? extends com.helger.commons.io.resource.IReadableResource>,Schema>
Base class for caching abstract
Schema objects. A Schema is
immutable and can therefore safely be used in multi-threaded environments.- Author:
- Philip Helger
-
Field Summary
Fields inherited from class com.helger.commons.cache.Cache
DEFAULT_ALLOW_NULL_VALUESFields inherited from class com.helger.commons.cache.MappedCache
m_aRWLock, NO_MAX_SIZE, STATISTICS_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionSchemaCache(String sSchemaTypeName, SchemaFactory aSchemaFactory, ErrorHandler aErrorHandler, LSResourceResolver aResourceResolver) -
Method Summary
Modifier and TypeMethodDescriptionstatic SchemacreateSchema(SchemaFactory aSchemaFactory, String sSchemaTypeName, com.helger.commons.collection.impl.ICommonsList<? extends com.helger.commons.io.resource.IReadableResource> aResources) final SchemagetSchema(com.helger.commons.io.resource.IReadableResource aResource) Get a cachedSchemafrom a single resource.final SchemagetSchema(com.helger.commons.io.resource.IReadableResource... aResources) Get a cachedSchemathat consists of multiple resources.final SchemagetSchema(Collection<? extends com.helger.commons.io.resource.IReadableResource> aResources) Get a cachedSchemathat consists of multiple resources.final SchemaFactoryfinal Stringfinal ValidatorgetValidator(com.helger.commons.io.resource.IReadableResource aResource) Get a new validator based on theSchemathat consists of a single resource.final ValidatorgetValidator(com.helger.commons.io.resource.IReadableResource... aResources) Get a new validator based on theSchemathat consists of multiple resources.final ValidatorgetValidator(Collection<? extends com.helger.commons.io.resource.IReadableResource> aResources) Get a new validator based on theSchemathat consists of multiple resources.final ValidatorgetValidatorFromSchema(Schema aSchema) Utility method to get the validator for a given schema using the error handler provided in the constructor.com.helger.commons.state.EChangeremoveFromCache(com.helger.commons.io.resource.IReadableResource aKey) Utility method to remove a single resource from the schema cache.toString()Methods inherited from class com.helger.commons.cache.MappedCache
clearCache, createCache, getCacheKeyProvider, getFromCache, getFromCacheNoStats, getFromCacheNoStatsNotLocked, getMaxSize, getName, getValueProvider, hasMaxSize, isAllowNullValues, isEmpty, isInCache, isNotEmpty, putInCache, putInCacheNotLocked, removeFromCache, size
-
Constructor Details
-
SchemaCache
public SchemaCache(@Nonnull String sSchemaTypeName, @Nonnull SchemaFactory aSchemaFactory, @Nullable ErrorHandler aErrorHandler, @Nullable LSResourceResolver aResourceResolver)
-
-
Method Details
-
getSchemaTypeName
-
getSchemaFactory
-
getErrorHandler
-
getResourceResolver
-
createSchema
-
getSchema
@Nonnull public final Schema getSchema(@Nonnull com.helger.commons.io.resource.IReadableResource aResource) Get a cachedSchemafrom a single resource. -
getSchema
@Nonnull public final Schema getSchema(@Nonnull @Nonempty com.helger.commons.io.resource.IReadableResource... aResources) Get a cachedSchemathat consists of multiple resources. -
getSchema
@Nonnull public final Schema getSchema(@Nonnull @Nonempty Collection<? extends com.helger.commons.io.resource.IReadableResource> aResources) Get a cachedSchemathat consists of multiple resources. -
getValidatorFromSchema
Utility method to get the validator for a given schema using the error handler provided in the constructor.- Parameters:
aSchema- The schema for which the validator is to be retrieved. May not benull.- Returns:
- The validator and never
null.
-
getValidator
@Nonnull public final Validator getValidator(@Nonnull com.helger.commons.io.resource.IReadableResource aResource) Get a new validator based on theSchemathat consists of a single resource. -
getValidator
@Nonnull public final Validator getValidator(@Nonnull @Nonempty com.helger.commons.io.resource.IReadableResource... aResources) Get a new validator based on theSchemathat consists of multiple resources. -
getValidator
@Nonnull public final Validator getValidator(@Nonnull @Nonempty Collection<? extends com.helger.commons.io.resource.IReadableResource> aResources) Get a new validator based on theSchemathat consists of multiple resources. -
removeFromCache
@Nonnull public com.helger.commons.state.EChange removeFromCache(@Nonnull com.helger.commons.io.resource.IReadableResource aKey) Utility method to remove a single resource from the schema cache.- Parameters:
aKey- The resource to remove. May not benull.- Returns:
EChange.
-
toString
- Overrides:
toStringin classcom.helger.commons.cache.MappedCache<com.helger.commons.collection.impl.ICommonsList<? extends com.helger.commons.io.resource.IReadableResource>,com.helger.commons.collection.impl.ICommonsList<? extends com.helger.commons.io.resource.IReadableResource>, Schema>
-