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

public abstract class MetadataProviderBase extends Object implements MetadataProvider
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 Details

  • Constructor Details

    • MetadataProviderBase

      public MetadataProviderBase()
  • Method Details

    • initializeMetadata

      protected abstract void initializeMetadata(Collection<Class<?>> types)
      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

      public boolean handles(Class<?> type)
      Indicates whether or not this provider handles metadata for the given data object type.
      Specified by:
      handles in interface MetadataProvider
      Parameters:
      type - the data object type to check.
      Returns:
      true if this provider will return any data for the given type, false otherwise
    • getSupportedTypes

      public Collection<Class<?>> getSupportedTypes()
      Returns a complete list of the data object types which will return data from this provider.
      Specified by:
      getSupportedTypes in interface MetadataProvider
      Returns:
      A non-null list of all the data object types supported by this provider.
    • provideMetadata

      public Map<Class<?>,DataObjectMetadata> provideMetadata()
      Provides the metadata available from this provider for all of it's data objects.
      Specified by:
      provideMetadata in interface MetadataProvider
      Returns:
      the metadata provided by this provider.
    • provideMetadataForTypes

      public Map<Class<?>,DataObjectMetadata> provideMetadataForTypes(Collection<Class<?>> types)
      Provides the metadata for the given types.
      Specified by:
      provideMetadataForTypes in interface MetadataProvider
      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:
      getMetadataForType in interface MetadataProvider
      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

      protected boolean isClassPersistable(Class<?> clazz)
      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:
      requiresListOfExistingTypes in interface MetadataProvider
      Returns:
      true if this provider will fail when passed an empty list of entity types