@ThreadSafe public class SchemaCache extends AbstractNotifyingCache<List<? extends IReadableResource>,Schema>
Schema objects. A Schema is
immutable and can therefore safely be used in multi-threaded environments.m_aCacheAccessStats, m_aRWLock, STATISTICS_PREFIX| Constructor and Description |
|---|
SchemaCache(String sSchemaTypeName,
SchemaFactory aSchemaFactory,
ErrorHandler aErrorHandler,
LSResourceResolver aResourceResolver) |
| Modifier and Type | Method and Description |
|---|---|
static Schema |
createSchema(SchemaFactory aSchemaFactory,
String sSchemaTypeName,
List<? extends IReadableResource> aResources) |
ErrorHandler |
getErrorHandler() |
LSResourceResolver |
getResourceResolver() |
Schema |
getSchema(Collection<? extends IReadableResource> aResources)
Get a cached
Schema that consists of multiple resources. |
Schema |
getSchema(IReadableResource... aResources)
Get a cached
Schema that consists of multiple resources. |
Schema |
getSchema(IReadableResource aResource)
Get a cached
Schema from a single resource. |
SchemaFactory |
getSchemaFactory() |
String |
getSchemaTypeName() |
Validator |
getValidator(Collection<? extends IReadableResource> aResources)
Get a new validator based on the
Schema that consists of multiple
resources. |
Validator |
getValidator(IReadableResource... aResources)
Get a new validator based on the
Schema that consists of multiple
resources. |
Validator |
getValidator(IReadableResource aResource)
Get a new validator based on the
Schema that consists of a single
resource. |
Validator |
getValidatorFromSchema(Schema aSchema)
Utility method to get the validator for a given schema using the error
handler provided in the constructor.
|
protected Schema |
getValueToCache(List<? extends IReadableResource> aKey)
This abstract method is invoked, once a new value needs to be put into the
cache.
|
EChange |
removeFromCache(IReadableResource aKey)
Utility method to remove a single resource from the schema cache.
|
String |
toString() |
getFromCacheclearCache, createCache, getFromCacheNoStats, getFromCacheNoStatsNotLocked, getFromCacheNotLocked, getMaxSize, getName, getSize, hasMaxSize, isEmpty, isNotEmpty, putInCache, putInCacheNotLocked, removeFromCachepublic SchemaCache(@Nonnull String sSchemaTypeName, @Nonnull SchemaFactory aSchemaFactory, @Nullable ErrorHandler aErrorHandler, @Nullable LSResourceResolver aResourceResolver)
@Nonnull public SchemaFactory getSchemaFactory()
@Nullable public ErrorHandler getErrorHandler()
@Nullable public LSResourceResolver getResourceResolver()
@Nonnull public static Schema createSchema(@Nonnull SchemaFactory aSchemaFactory, @Nonnull String sSchemaTypeName, @Nonnull @Nonempty List<? extends IReadableResource> aResources)
@Nonnull @IsLocked(value=WRITE) protected Schema getValueToCache(@Nonnull @Nonempty List<? extends IReadableResource> aKey)
AbstractNotifyingCachegetValueToCache in class AbstractNotifyingCache<List<? extends IReadableResource>,Schema>aKey - The key for which the value to cache is required. May be
nullable or not - depends upon the implementation.null.@Nonnull public final Schema getSchema(@Nonnull IReadableResource aResource)
Schema from a single resource.@Nonnull public final Schema getSchema(@Nonnull @Nonempty IReadableResource... aResources)
Schema that consists of multiple resources.@Nonnull public final Schema getSchema(@Nonnull @Nonempty Collection<? extends IReadableResource> aResources)
Schema that consists of multiple resources.@Nonnull public final Validator getValidatorFromSchema(@Nonnull Schema aSchema)
aSchema - The schema for which the validator is to be retrieved. May not be
null.null.@Nonnull public final Validator getValidator(@Nonnull IReadableResource aResource)
Schema that consists of a single
resource.aResource - The resource to parse into a single Schema. May not be
null.Validator object. Never null.getSchema(IReadableResource)@Nonnull public final Validator getValidator(@Nonnull @Nonempty IReadableResource... aResources)
Schema that consists of multiple
resources.aResources - The resources to parse into a single Schema. May neither
null nor empty nor may it contain null
elements.Validator object. Never null.getSchema(IReadableResource...)@Nonnull public final Validator getValidator(@Nonnull @Nonempty Collection<? extends IReadableResource> aResources)
Schema that consists of multiple
resources.aResources - The resources to parse into a single Schema. May neither
null nor empty nor may it contain null
elements.Validator object. Never null.getSchema(Collection)@Nonnull public EChange removeFromCache(@Nonnull IReadableResource aKey)
aKey - The resource to remove. May not be null.EChange.public String toString()
toString in class AbstractCache<List<? extends IReadableResource>,Schema>Copyright © 2014–2015 Philip Helger. All rights reserved.