Benjamin Wright | 728b9b5 | 2018-07-03 13:28:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | package org.webrtc; |
| 12 | |
| 13 | import javax.annotation.Nullable; |
| 14 | |
| 15 | /** |
| 16 | * PeerConnectionDependencies holds all PeerConnection dependencies that are |
| 17 | * applied per PeerConnection. A dependency is distinct from a configuration |
| 18 | * as it defines significant executable code that can be provided by a user of |
| 19 | * the API. |
| 20 | */ |
| 21 | public final class PeerConnectionDependencies { |
| 22 | // Mandatory dependencies. |
| 23 | private PeerConnection.Observer observer; |
| 24 | |
| 25 | public static class Builder { |
| 26 | private PeerConnection.Observer observer; |
| 27 | |
| 28 | private Builder(PeerConnection.Observer observer) { |
| 29 | this.observer = observer; |
| 30 | } |
| 31 | |
| 32 | // Observer is a required dependency and so is forced in the construction of the object. |
| 33 | public PeerConnectionDependencies createPeerConnectionDependencies() { |
| 34 | return new PeerConnectionDependencies(observer); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | public static Builder builder(PeerConnection.Observer observer) { |
| 39 | return new Builder(observer); |
| 40 | } |
| 41 | |
| 42 | PeerConnection.Observer getObserver() { |
| 43 | return observer; |
| 44 | } |
| 45 | |
| 46 | private PeerConnectionDependencies(PeerConnection.Observer observer) { |
| 47 | this.observer = observer; |
| 48 | } |
| 49 | } |