Java by API/javax.naming/CompositeName

Материал из Java эксперт
Версия от 17:43, 31 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

CompositeName: add(int posn, String comp)

   <source lang="java">

import javax.naming.rupositeName; public class Main {

 public static void main(String[] argv) throws Exception {
   CompositeName composite = new CompositeName("cn=John,o=hits/summary.txt");
   String first = composite.get(0);
   String last = composite.get(composite.size() - 1); 
   composite.add(0, "yourname.ru"); 
   composite.remove(2); 
 }

}

 </source>
   
  
 
  



CompositeName: get(int posn)

   <source lang="java">

import javax.naming.rupositeName; public class Main {

 public static void main(String[] argv) throws Exception {
   CompositeName composite = new CompositeName("cn=John,o=hits/summary.txt");
   String first = composite.get(0);
   String last = composite.get(composite.size() - 1); 
   composite.add(0, "yourname.ru"); 
   composite.remove(2); 
 }

}

 </source>
   
  
 
  



CompositeName: remove(int posn)

   <source lang="java">

import javax.naming.rupositeName; public class Main {

 public static void main(String[] argv) throws Exception {
   CompositeName composite = new CompositeName("cn=John,o=hits/summary.txt");
   String first = composite.get(0);
   String last = composite.get(composite.size() - 1); 
   composite.add(0, "yourname.ru"); 
   composite.remove(2); 
 }

}

 </source>
   
  
 
  



new CompositeName(String n)

   <source lang="java">

import javax.naming.rupositeName; public class Main {

 public static void main(String[] argv) throws Exception {
   CompositeName composite = new CompositeName("cn=John,o=hits/summary.txt");
   String first = composite.get(0);
   String last = composite.get(composite.size() - 1); 
   composite.add(0, "yourname.ru"); 
   composite.remove(2); 
 }

}

 </source>