KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > beancoder > MgnlValue


1 package info.magnolia.beancoder;
2
3 import openwfe.org.jcr.JcrException;
4 import openwfe.org.jcr.JcrProxy;
5 import openwfe.org.jcr.Value;
6
7 import javax.jcr.RepositoryException;
8
9 /**
10  * Magnolia Wrapper for value
11  */

12 public class MgnlValue implements Value {
13
14     javax.jcr.Value v;
15
16     public Object JavaDoc getWrappedInstance() throws JcrException {
17         return v;
18     }
19
20     public MgnlValue(javax.jcr.Value v) {
21         this.v = v;
22     }
23
24     public String JavaDoc getString() throws JcrException {
25         try {
26             return v.getString();
27         } catch (RepositoryException e) {
28             throw new JcrException(e.getMessage());
29         }
30     }
31
32     public int getType() {
33         return v.getType();
34     }
35
36
37     public long getLong() throws JcrException {
38         try {
39             return v.getLong();
40         } catch (RepositoryException e) {
41             throw new JcrException(e.getMessage(),e);
42         }
43     }
44
45     public Object JavaDoc getValue() throws JcrException {
46         return JcrProxy.wrapJcrValue(v).getValue();
47     }
48 }
49
Popular Tags