Clover coverage report - Ledge Components - SNAPSHOT
Coverage timestamp: Fri Nov 17 2006 05:13:20 CET
file stats: LOC: 77   Methods: 5
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DefaultPrincipal.java 100% 100% 100% 100%
coverage
 1    package org.objectledge.authentication;
 2   
 3    import java.security.Principal;
 4   
 5    /**
 6    * An implementation of {@link Principal} interface.
 7    *
 8    * @author <a href="mailto:rafal@apache.org">Rafal Krzewski</a>
 9    * @author <a href="mailto:pablo@apache.org">Pawel Potempski</a>
 10    * @version $Id: DefaultPrincipal.java,v 1.2 2004/12/23 07:16:34 rafal Exp $
 11    */
 12    public class DefaultPrincipal
 13    implements Principal
 14    {
 15    /** The name of the principal */
 16    private String name;
 17   
 18    /**
 19    * Constructor.
 20    *
 21    * @param name the name of the principal
 22    */
 23  782 public DefaultPrincipal(String name)
 24    {
 25  782 this.name = name;
 26    }
 27   
 28    /**
 29    * {@inheritDoc}
 30    */
 31  92 public boolean equals(Object obj)
 32    {
 33  92 if(obj instanceof Principal)
 34    {
 35  46 return name.equals(((Principal)obj).getName());
 36    }
 37  46 return false;
 38    }
 39   
 40    /**
 41    * {@inheritDoc}
 42    */
 43  966 public String getName()
 44    {
 45  966 return name;
 46    }
 47   
 48    /**
 49    * {@inheritDoc}
 50    */
 51  138 public int hashCode()
 52    {
 53  138 if(name != null)
 54    {
 55  46 return name.hashCode();
 56    }
 57    else
 58    {
 59  92 return 0;
 60    }
 61    }
 62   
 63    /**
 64    * {@inheritDoc}
 65    */
 66  92 public String toString()
 67    {
 68  92 if(name != null)
 69    {
 70  46 return super.toString()+"("+name.toString()+")";
 71    }
 72    else
 73    {
 74  46 return super.toString()+"(null)";
 75    }
 76    }
 77    }