public TopologyEvent()

in src/main/java/org/apache/sling/discovery/TopologyEvent.java [87:123]


    public TopologyEvent(final Type type, final TopologyView oldView,
            final TopologyView newView) {
        if (type == null) {
            throw new IllegalArgumentException("type must not be null");
        }

        if (type == Type.TOPOLOGY_INIT) {
            // then oldView is null
            if (oldView != null) {
                throw new IllegalArgumentException("oldView must be null");
            }
            // and newView must be not null
            if (newView == null) {
                throw new IllegalArgumentException("newView must not be null");
            }
        } else if (type == Type.TOPOLOGY_CHANGING) {
            // then newView is null
            if (newView != null) {
                throw new IllegalArgumentException("newView must be null");
            }
            // and oldView must not be null
            if (oldView == null) {
                throw new IllegalArgumentException("oldView must not be null");
            }
        } else {
            // in all other cases both oldView and newView must not be null
            if (oldView == null) {
                throw new IllegalArgumentException("oldView must not be null");
            }
            if (newView == null) {
                throw new IllegalArgumentException("newView must not be null");
            }
        }
        this.type = type;
        this.oldView = oldView;
        this.newView = newView;
    }