01: package org.osbl.orga.model;
02:
03: import org.conform.format.*;
04: import org.conform.BeanMeta;
05: import org.conform.BeanMetaProvider;
06: import org.osbl.ServiceProvider;
07:
08: public class MembershipFormat extends AbstractFormat {
09: BeanMetaProvider staticBeanMetaProvider = (BeanMetaProvider) ServiceProvider
10: .getInstance().getService("StaticBeanMetaProvider");
11:
12: public String format(Object value) {
13: Membership membership = (Membership) value;
14:
15: StringBuilder buffer = new StringBuilder();
16:
17: if (membership.getRole() != null) {
18: buffer.append(membership.getRole());
19: buffer.append(" ");
20: }
21:
22: if (membership.getMember() != null) {
23: BeanMeta beanMeta = staticBeanMetaProvider
24: .getBeanMeta(Member.class);
25: Format format = beanMeta.getFormat();
26: if (format == null)
27: format = new NoFormat();
28: buffer.append(format.format(membership.getMember()));
29: } else
30: buffer.append("-");
31:
32: return buffer.toString();
33: }
34: }
|