com.buschmais.xo.api.metadata.MetadataProvider Maven / Gradle / Ivy
The newest version!
package com.buschmais.xo.api.metadata;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.util.Map;
import java.util.Set;
import com.buschmais.xo.api.metadata.method.AbstractRelationPropertyMethodMetadata;
import com.buschmais.xo.api.metadata.type.*;
/**
* Defines the interface for the metadata provider.
*
* @param
* The type of datastore specific entity metadata.
* @param
* The type of datastore specific entity type discriminators.
* @param
* The type of datastore specific relation metadata.
* @param
* The type of datastore specific relationtype discriminators.
*/
public interface MetadataProvider, EntityDiscriminator, RelationMetadata extends DatastoreRelationMetadata, RelationDiscriminator> {
/**
* Determine the {@link CompositeTypeMetadata} for a given set of entity discriminators.
*
* @param entityDiscriminators
* The entity descriminators.
* @return The {@link CompositeTypeMetadata}.
*/
CompositeTypeMetadata> getTypes(Set entityDiscriminators);
/**
* Determine the set of entity discriminators for the given {@link CompositeTypeMetadata}.
*
* @param types
* The {@link CompositeTypeMetadata}.
* @return The set of discriminators.
*/
Set getEntityDiscriminators(CompositeTypeMetadata> types);
/**
* Determine the {@link CompositeTypeMetadata} for a given relation discriminator.
*
* @param discriminator
* The relation descriminator.
* @return The {@link CompositeTypeMetadata}.
*/
CompositeTypeMetadata> getRelationTypes(Set sourceDiscriminators,
RelationDiscriminator discriminator, Set targetDiscriminators);
/**
* Return a collection of all registered entity type metadata.
*
* @return The collection of all registered entity type metadata.
*/
Map, TypeMetadata> getRegisteredMetadata();
/**
* Return the entity metadata for a specific type.
*
* @param type
* The type.
* @return The entity metadata.
*/
EntityTypeMetadata getEntityMetadata(Class> type);
/**
* Return the relation metadata for a specific type.
*
* @param relationType
* The relation type.
* @return The relation metadata.
*/
RelationTypeMetadata getRelationMetadata(Class> relationType);
RelationTypeMetadata.Direction getRelationDirection(Set> sourceTypes, RelationTypeMetadata relationMetadata,
Set> targetTypes);
/**
* Return the repository metadata for a specific type.
*
* @param repositoryType
* The repository type.
* @return The repository metadata.
*/
RepositoryTypeMetadata getRepositoryMetadata(Class> repositoryType);
/**
* Return the property which represents a relation in an entity.
*
* @param entityType
* The entity.
* @param relationType
* The relation type.
* @param direction
* The direction.
* @param
* The Relation type.
* @return The property metadata.
*/
AbstractRelationPropertyMethodMetadata> getPropertyMetadata(Class> entityType, Class relationType, RelationTypeMetadata.Direction direction);
/**
* Return the annotation which represents a query definition.
*
* @param annotatedElement
* The annotated element.
* @param
* The annotation type.
* @return The annotation or null if the element is not annotated with a query.
*/
QL getQuery(AnnotatedElement annotatedElement);
CompositeTypeMetadata> getEffectiveTypes(Class> type, Class>[] types);
}