EMMA Coverage Report (generated Sun May 02 20:42:29 CEST 2010)
[all classes][hu.netmind.beankeeper.model]

COVERAGE SUMMARY FOR SOURCE FILE [ClassEntry.java]

nameclass, %method, %block, %line, %
ClassEntry.java100% (1/1)100% (9/9)98%  (121/123)96%  (24/25)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ClassEntry100% (1/1)100% (9/9)98%  (121/123)96%  (24/25)
equals (Object): boolean 100% (1/1)83%  (10/12)67%  (2/3)
ClassEntry (Class, String): void 100% (1/1)100% (46/46)100% (9/9)
ClassEntry (Object): void 100% (1/1)100% (13/13)100% (2/2)
getDynamicName (): String 100% (1/1)100% (3/3)100% (1/1)
getFullName (): String 100% (1/1)100% (3/3)100% (1/1)
getSourceClass (): Class 100% (1/1)100% (3/3)100% (1/1)
getSuperEntry (): ClassEntry 100% (1/1)100% (27/27)100% (6/6)
hashCode (): int 100% (1/1)100% (4/4)100% (1/1)
toString (): String 100% (1/1)100% (12/12)100% (1/1)

1/**
2 * Copyright (C) 2007 NetMind Consulting Bt.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 */
18 
19package hu.netmind.beankeeper.model;
20 
21import java.lang.reflect.Modifier;
22import java.io.Serializable;
23 
24/**
25 * This class describes a persistable class. This is a finer grained
26 * thing than static classes, because the library allows for dynamic
27 * classes (classnames) to be created. So an unambigous description of
28 * a persistable class is it's class, and the dynamic name.<br>
29 * If the dynamic name is not given, the class is considered a static
30 * class, these are the normal Java classes. If the dynamic name is
31 * given, the class is considered a dynamic class, which has no
32 * actual class in the JVM, but it's also considered a subclass of the
33 * root static class contained.
34 * @author Brautigam Robert
35 * @version Revision: $Revision$
36 */
37public class ClassEntry implements Serializable
38{
39   private Class clazz;
40   private String dynamicName;
41   private String fullName;
42 
43   public ClassEntry(Object obj)
44   {
45      this(obj.getClass(),(obj instanceof DynamicObject)?
46            ((DynamicObject)obj).getPersistenceDynamicName():null);
47   }
48 
49   public ClassEntry(Class clazz, String dynamicName)
50   {
51      this.clazz=clazz;
52      this.dynamicName=dynamicName;
53      if ( (!DynamicObject.class.isAssignableFrom(clazz)) || 
54            (dynamicName==null) || (dynamicName.length()==0) ||
55            (!Character.isLetter(dynamicName.charAt(0))) )
56         this.dynamicName=null;
57      if ( dynamicName == null )
58         fullName = clazz.getName();
59      else
60         fullName = clazz.getName()+"."+dynamicName;
61   }
62 
63   public ClassEntry getSuperEntry()
64   {
65      ClassEntry superEntry = null;
66      if ( getDynamicName() != null )
67      {
68         // Dynamic class
69         superEntry = new ClassEntry(getSourceClass(),null);
70      } else {
71         if ( getSourceClass().getSuperclass() != null )
72            superEntry = new ClassEntry(getSourceClass().getSuperclass(),null);
73      }
74      return superEntry;
75   }
76 
77   public Class getSourceClass()
78   {
79      return clazz;
80   }
81 
82   public String getDynamicName()
83   {
84      return dynamicName;
85   }
86 
87   public String getFullName()
88   {
89      return fullName;
90   }
91 
92   public String toString()
93   {
94      return "[ClassEntry: "+fullName+"]";
95   }
96 
97   public int hashCode()
98   {
99      return fullName.hashCode();
100   }
101 
102   public boolean equals(Object obj)
103   {
104      if ( ! (obj instanceof ClassEntry) )
105         return false;
106      return ((ClassEntry)obj).getFullName().equals(getFullName());
107   }
108}
109 

[all classes][hu.netmind.beankeeper.model]
EMMA 2.0.5312debian (C) Vladimir Roubtsov