Class MetadataProviderBase
java.lang.Object
org.kuali.rice.krad.data.provider.impl.MetadataProviderBase
- All Implemented Interfaces:
MetadataProvider,Provider
- Direct Known Subclasses:
AnnotationMetadataProviderImpl,CompositeMetadataProviderImpl,JpaMetadataProviderImpl,SpringMetadataProviderImpl
Superclass for all metadata providers which contain the basic operations and data structure.
All each subclass needs to implement is the initializeMetadata method.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConcurrentHashMap<Class<?>, DataObjectMetadata> The map of types to metadata. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetMetadataForType(Class<?> dataObjectType) Obtains the metadata for a specific data type.Collection<Class<?>> Returns a complete list of the data object types which will return data from this provider.booleanIndicates whether or not this provider handles metadata for the given data object type.protected abstract voidinitializeMetadata(Collection<Class<?>> types) Performs the initialization of the provider with the given set of types.protected booleanisClassPersistable(Class<?> clazz) Determines whether the given class can be persisted.Provides the metadata available from this provider for all of it's data objects.provideMetadataForTypes(Collection<Class<?>> types) Provides the metadata for the given types.booleanFlag which allows the service to indicate that it requires knowledge of previously discovered persistable entities.
-
Field Details
-
masterMetadataMap
The map of types to metadata.
-
-
Constructor Details
-
MetadataProviderBase
public MetadataProviderBase()
-
-
Method Details
-
initializeMetadata
Performs the initialization of the provider with the given set of types.If the list is null or empty, the provider is expected to discover the types via other means, or do nothing if the types cannot be discovered.
-
handles
Indicates whether or not this provider handles metadata for the given data object type.- Specified by:
handlesin interfaceMetadataProvider- Parameters:
type- the data object type to check.- Returns:
- true if this provider will return any data for the given type, false otherwise
-
getSupportedTypes
Returns a complete list of the data object types which will return data from this provider.- Specified by:
getSupportedTypesin interfaceMetadataProvider- Returns:
- A non-null list of all the data object types supported by this provider.
-
provideMetadata
Provides the metadata available from this provider for all of it's data objects.- Specified by:
provideMetadatain interfaceMetadataProvider- Returns:
- the metadata provided by this provider.
-
provideMetadataForTypes
Provides the metadata for the given types.- Specified by:
provideMetadataForTypesin interfaceMetadataProvider- Parameters:
types- the list of types for which to get the metadata.- Returns:
- a Map of the data object types to their metadata.
-
getMetadataForType
public DataObjectMetadata getMetadataForType(Class<?> dataObjectType) throws IllegalArgumentException Obtains the metadata for a specific data type.- Specified by:
getMetadataForTypein interfaceMetadataProvider- Parameters:
dataObjectType- the type for which to get the metadata.- Returns:
- The metadata for the given data object or null if no metadata is available for the given type.
- Throws:
IllegalArgumentException- if the data object type is null.
-
isClassPersistable
Determines whether the given class can be persisted.- Parameters:
clazz- the class to check for persistability.- Returns:
- true if the class is persistable, false otherwise.
-
requiresListOfExistingTypes
public boolean requiresListOfExistingTypes()Flag which allows the service to indicate that it requires knowledge of previously discovered persistable entities.That is, the service is designed only to process existing objects and not to create new ones.
By default, providers are assumed to be able to pull the list of annotated types from somewhere.- Specified by:
requiresListOfExistingTypesin interfaceMetadataProvider- Returns:
- true if this provider will fail when passed an empty list of entity types
-