All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.vpro.domain.media.exceptions.CircularReferenceException Maven / Gradle / Ivy

Go to download

The basic domain classes for 'media', the core of POMS. Also, the 'update' XML bindings for it. It also contains some closely related domain classes like the enum to contain NICAM kijkwijzer settings.

There is a newer version: 8.3.1
Show newest version
/*
 * Copyright (C) 2010 Licensed under the Apache License, Version 2.0
 * VPRO The Netherlands
 */
package nl.vpro.domain.media.exceptions;

import java.io.Serial;
import java.util.*;

import nl.vpro.domain.media.MediaObject;

public class CircularReferenceException extends RuntimeException {

    @Serial
    private static final long serialVersionUID = -6557241432901240561L;

    private final List familyTree = new ArrayList<>();

    private CircularReferenceException(String message, MediaObject child, List ancestry) {
        super(message);
        familyTree.addAll(ancestry);
        familyTree.add(child);
    }

    public CircularReferenceException(MediaObject child, MediaObject parent,  List ancestry) {
        this("Circular reference: " + parent + " has ancestors " + ancestry + "", child, ancestry);
    }

    public static CircularReferenceException self(MediaObject child, MediaObject parent, List ancestry) {
        return new CircularReferenceException("Can't make " + child + " member of itself " + parent, child, ancestry);
    }

    public List getFamilyTree() {
        return Collections.unmodifiableList(familyTree);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy