TypeService

public interface TypeService

The TypeService is an interface defining available methods to execute various actions on Field Types.

Methods

findType

TypeDto findType(Class<?> clazz)

Retrieves MDS type, based on the class that handles that type in the backend. Throws org.motechproject.mds.exception.type.NoSuchTypeException when the given class does not handle any MDS type.

Parameters:
  • clazz – handler class
Returns:

MDS type that is handled by the given class

findValidations

List<TypeValidation> findValidations(TypeDto type, Class<? extends Annotation> aClass)

Retrieves all MDS validations for the given type, that are triggered by the given annotation.

Parameters:
  • type – MDS type representation
  • aClass – Annotation class type
Returns:

A list of validations that match the criteria or empty list, if none were found

See also: org.motechproject.mds.domain.TypeValidation

getAllTypes

List<TypeDto> getAllTypes()

Retrieves all available MDS types.

Returns:a list of types

getType

Type getType(TypeValidation validation)

Retrieves MDS Type, connected to the given validation.

Parameters:
  • validation – Validation representation
Returns:

MDS Type that is connected to this validation

See also: org.motechproject.mds.domain.TypeValidation