Merge branch 'security-summit' into 'master'
[platform/upstream/iotivity.git] / service / resource-encapsulation / android / service / src / main / java / org / iotivity / service / client / RcsAddress.java
1 /******************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20
21 package org.iotivity.service.client;
22
23 /**
24  * This class provides a set of APIs for constructing RCSAddress object.
25  *
26  * <p>
27  * RCSAddress object is the first parameter for Discover Resource APIs of
28  * RCSDiscoveryManager Class.
29  * <p>
30  * {@link RcsDiscoveryManager}
31  */
32 public final class RcsAddress {
33     private final String mAddress;
34
35     private RcsAddress(String addr) {
36         mAddress = addr;
37     }
38
39     /**
40      * Factory method for multicast.
41      *
42      */
43     public static RcsAddress multicast() {
44         return new RcsAddress(null);
45     }
46
47     /**
48      * Factory method for unicast.
49      *
50      * @param address
51      *            A physical address for the target.
52      *
53      * @throws NullPointerException
54      *             If address is null.
55      */
56     public static RcsAddress unicast(String address) {
57         if (address == null) throw new NullPointerException("address is null.");
58         return new RcsAddress(address);
59     }
60
61     String getAddress() {
62         return mAddress;
63     }
64 }