File: simple.xml

package info (click to toggle)
libspring-ldap-java 1.3.1.RELEASE-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 2,872 kB
  • sloc: java: 12,509; xml: 4,106; jsp: 36; makefile: 33; sh: 13
file content (35 lines) | stat: -rw-r--r-- 1,556 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?xml version="1.0" encoding="UTF-8"?>
               
<chapter id="simple">
  <title>Java 5 Support</title>

  <sect1 id="simple-ldap-template">
    <title>SimpleLdapTemplate</title>

    <para>As of version 1.3 Spring LDAP includes the spring-ldap-core-tiger.jar distributable, which adds
    a thin layer of Java 5 functionality on top of Spring LDAP.</para>
    
    <para>The <literal>SimpleLdapTemplate</literal> class adds search and lookup methods that take a 
    <literal>ParameterizedContextMapper</literal>, adding generics support to these methods.</para>
    
    <para><literal>ParametrizedContextMapper</literal> is a typed version of <literal>ContextMapper</literal>,
    which simplifies working with searches and lookups:
    <example>
    <title>Using <literal>ParameterizedContextMapper</literal></title>
    <programlisting>public List&lt;Person&gt; getAllPersons(){
    return simpleLdapTemplate.search("", "(objectclass=person)",
               new <emphasis role="bold">ParameterizedContextMapper&lt;Person&gt;</emphasis>() {
                   public <emphasis role="bold">Person</emphasis> mapFromContext(Object ctx) {
                       DirContextAdapter adapter = (DirContextAdapter) ctx;
                       Person person = new Person();
                       // Fill the domain object with data from the DirContextAdapter
               
                       return person;
                   }
               };
}
    </programlisting>
    </example>
    </para>
  </sect1>
</chapter>