Skip to content
Snippets Groups Projects
Commit b0cf35e4 authored by Lotte Hofstede's avatar Lotte Hofstede
Browse files

added missing typedoc

parent 200b29f6
Branches
Tags
No related merge requests found
......@@ -276,7 +276,7 @@ export class SearchConfigurationService implements OnDestroy {
}
/**
* Make sure to unsubscribe from all existing subscription to prevent memory leaksNormalizedRelationship
* Make sure to unsubscribe from all existing subscription to prevent memory leaks
*/
ngOnDestroy(): void {
this.subs.forEach((sub) => {
......
......@@ -10,6 +10,11 @@ const relationshipKey = Symbol('relationship');
const relationshipMap = new Map();
const typeMap = new Map();
/**
* Decorator function to map a normalized class to it's not-normalized counter part class
* It will also maps a type to the matching class
* @param value The not-normalized class to map to
*/
export function mapsTo(value: GenericConstructor<TypedObject>) {
return function decorator(objectConstructor: GenericConstructor<TypedObject>) {
Reflect.defineMetadata(mapsToMetadataKey, value, objectConstructor);
......@@ -17,6 +22,12 @@ export function mapsTo(value: GenericConstructor<TypedObject>) {
}
}
/**
* Maps a type to the matching class
* @param value The resourse type
* @param objectConstructor The class to map to
*/
function mapsToType(value: ResourceType, objectConstructor: GenericConstructor<TypedObject>) {
if (!objectConstructor || !value) {
return;
......@@ -24,10 +35,18 @@ function mapsToType(value: ResourceType, objectConstructor: GenericConstructor<T
typeMap.set(value.value, objectConstructor);
}
/**
* Returns the mapped class for the given normalized class
* @param target The normalized class
*/
export function getMapsTo(target: any) {
return Reflect.getOwnMetadata(mapsToMetadataKey, target);
}
/**
* Returns the mapped class for the given type
* @param type The resource type
*/
export function getMapsToType(type: string | ResourceType) {
if (typeof(type) === 'object') {
type = (type as ResourceType).value;
......
......@@ -3,6 +3,9 @@ import { SubmissionSectionModel } from './config-submission-section.model';
import { PaginatedList } from '../../data/paginated-list';
import { ResourceType } from '../../shared/resource-type';
/**
* Class for the configuration describing the submission
*/
export class SubmissionDefinitionModel extends ConfigObject {
static type = new ResourceType('submissiondefinition');
......
/**
* Class that represents the type of an object as returned by the REST server
*/
export class ResourceType {
constructor(public value: string) {
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment