2 LinphoneAddressImpl.java
3 Copyright (C) 2010 Belledonne Communications, Grenoble, France
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.
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.
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.
19 package org.linphone.core;
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);
35 protected LinphoneAddressImpl(String identity) {
36 nativePtr = newLinphoneAddressImpl(identity, null);
39 protected LinphoneAddressImpl(String username,String domain,String displayName) {
40 nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName);
42 protected LinphoneAddressImpl(long aNativePtr,boolean javaOwnPtr) {
43 nativePtr = aNativePtr;
46 protected LinphoneAddressImpl(long aNativePtr) {
47 nativePtr = aNativePtr;
50 protected void finalize() throws Throwable {
51 if (ownPtr) delete(nativePtr);
53 public String getDisplayName() {
54 return getDisplayName(nativePtr);
56 public String getDomain() {
57 return getDomain(nativePtr);
59 public String getUserName() {
60 return getUserName(nativePtr);
63 public String toString() {
64 return toString(nativePtr);
66 public String toUri() {
67 return toUri(nativePtr);
69 public void setDisplayName(String name) {
70 setDisplayName(nativePtr,name);
72 public String asString() {
75 public String asStringUriOnly() {
76 return toUri(nativePtr);
79 throw new RuntimeException("Not implemented");
81 public String getPort() {
82 return String.valueOf(getPortInt());
84 public int getPortInt() {
87 public void setDomain(String domain) {
88 throw new RuntimeException("Not implemented");
90 public void setPort(String port) {
91 throw new RuntimeException("Not implemented");
93 public void setPortInt(int port) {
94 throw new RuntimeException("Not implemented");
96 public void setUserName(String username) {
97 throw new RuntimeException("Not implemented");