KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > olap > model > MemberPropertyMeta


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.jpivot.olap.model;
14
15 import java.util.Comparator JavaDoc;
16
17
18 /**
19  * @author av
20  */

21 public final class MemberPropertyMeta implements Displayable {
22   private String JavaDoc name;
23   private String JavaDoc scope;
24   private String JavaDoc label;
25   
26   /**
27    * vergleicht den return Wert von getKey() ohne die String instanzen wirklich zu erzeugen.
28    */

29   public static final Comparator JavaDoc KEY_COMPARATOR = new Comparator JavaDoc() {
30     public int compare(Object JavaDoc o1, Object JavaDoc o2) {
31       MemberPropertyMeta m1 = (MemberPropertyMeta) o1;
32       MemberPropertyMeta m2 = (MemberPropertyMeta) o2;
33       int comp = m1.getScope().compareTo(m2.getScope());
34       if (comp == 0)
35         return m1.getName().compareTo(m2.getName());
36       return comp;
37     }
38   };
39   
40   public MemberPropertyMeta() {
41   }
42
43   public MemberPropertyMeta(String JavaDoc label, String JavaDoc name, String JavaDoc scope) {
44     this.label = label;
45     this.name = name;
46     this.scope = scope;
47   }
48
49   public void accept(Visitor visitor) {
50     visitor.visitMemberPropertyMeta(this);
51   }
52
53   public String JavaDoc getName() {
54     return name;
55   }
56
57   public String JavaDoc getScope() {
58     return scope;
59   }
60
61   public void setName(String JavaDoc string) {
62     name = string;
63   }
64
65   public void setScope(String JavaDoc string) {
66     scope = string;
67   }
68
69   public String JavaDoc getLabel() {
70     return label;
71   }
72
73   public void setLabel(String JavaDoc string) {
74     label = string;
75   }
76   
77   public String JavaDoc getKey() {
78     return scope + "." + name;
79   }
80   
81   public String JavaDoc toString() {
82     return "MemberPropertyMeta[" + name + ", " + label + ", " + scope + "]";
83   }
84
85 }
86
Popular Tags