]> sjero.net Git - linphone/blob - LinphoneAddressImpl.java
Merge remote-tracking branch 'newui/newUI' into newUI
[linphone] / LinphoneAddressImpl.java
1 /*
2 LinphoneAddressImpl.java
3 Copyright (C) 2010  Belledonne Communications, Grenoble, France
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19 package org.linphone.core;
20
21
22
23 public class LinphoneAddressImpl implements LinphoneAddress {
24         protected final long nativePtr;
25         boolean ownPtr = false;
26         private native long newLinphoneAddressImpl(String uri,String displayName);
27         private native void  delete(long ptr);
28         private native String getDisplayName(long ptr);
29         private native String getUserName(long ptr);
30         private native String getDomain(long ptr);
31         private native String toUri(long ptr);
32         private native void setDisplayName(long ptr,String name);
33         private native String toString(long ptr);
34         
35         protected LinphoneAddressImpl(String identity)  {
36                 nativePtr = newLinphoneAddressImpl(identity, null);
37         }
38         
39         protected LinphoneAddressImpl(String username,String domain,String displayName)  {
40                 nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName);
41         }
42         protected LinphoneAddressImpl(long aNativePtr,boolean javaOwnPtr)  {
43                 nativePtr = aNativePtr;
44                 ownPtr=javaOwnPtr;
45         }
46         protected LinphoneAddressImpl(long aNativePtr)  {
47                 nativePtr = aNativePtr;
48                 ownPtr=false;
49         }
50         protected void finalize() throws Throwable {
51                 if (ownPtr) delete(nativePtr);
52         }
53         public String getDisplayName() {
54                 return getDisplayName(nativePtr);
55         }
56         public String getDomain() {
57                 return getDomain(nativePtr);
58         }
59         public String getUserName() {
60                 return getUserName(nativePtr);
61         }
62         
63         public String toString() {
64                 return toString(nativePtr);
65         }
66         public String toUri() {
67                 return toUri(nativePtr);        
68         }
69         public void setDisplayName(String name) {
70                 setDisplayName(nativePtr,name);
71         }
72         public String asString() {
73                 return toString();
74         }
75         public String asStringUriOnly() {
76                 return toUri(nativePtr);
77         }
78         public void clean() {
79                 throw new RuntimeException("Not implemented");
80         }
81         public String getPort() {
82                 return String.valueOf(getPortInt());
83         }
84         public int getPortInt() {
85                 return getPortInt();
86         }
87         public void setDomain(String domain) {
88                 throw new RuntimeException("Not implemented");
89         }
90         public void setPort(String port) {
91                 throw new RuntimeException("Not implemented");
92         }
93         public void setPortInt(int port) {
94                 throw new RuntimeException("Not implemented");
95         }
96         public void setUserName(String username) {
97                 throw new RuntimeException("Not implemented");
98         }
99  
100 }