7 PrincipalImpl synopsis

Document Sample
7 PrincipalImpl synopsis Powered By Docstoc
					PrincipalImpl -- synopsis by Florian Mueller (http://fosspatents.blogspot.com -- Twitter:FOSSpatents)

    Source code generated by decompilation of PrincipalImpl.class                        Source code shipped by Google
       (jdk1.5.0.22; spaces and blank lines inserted manually)          (Android "Froyo" release; spaces and blank lines inserted manually)

// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel                    /*
Kouznetsov.                                                            * Licensed to the Apache Software Foundation (ASF)
// Jad home page: http://www.kpdus.com/jad.html                       under one or more
// Decompiler options: packimports(3)                                  * contributor license agreements. See the NOTICE file
// Source File Name:   PrincipalImpl.java                             distributed with
                                                                       * this work for additional information regarding
                                                                      copyright ownership.
                                                                       * The ASF licenses this file to You under the Apache
                                                                      License, Version 2.0
                                                                       * (the "License"); you may not use this file except in
                                                                      compliance with
                                                                       * the License. You may obtain a copy of the License at
                                                                       *     http://www.apache.org/licenses/LICENSE-2.0
                                                                       * Unless required by applicable law or agreed to in
                                                                      writing, software
                                                                       * distributed under the License is distributed on an
                                                                      "AS IS" BASIS,
                                                                       * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
                                                                      express or implied.
                                                                       * See the License for the specific language governing
                                                                      permissions and
                                                                       * limitations under the License.

package sun.security.acl;                                             package org.apache.harmony.security.tests.support.acl;

import java.security.Principal;                                       import java.security.Principal;

                                                                       * Additional class for verification Principal interface

                                                       PrincipalImpl synopsis -- page 1 of 3
public class PrincipalImpl                                                               public class PrincipalImpl implements Principal {
    implements Principal
                                                                                             private String user;1

      public PrincipalImpl(String s)                                                         public PrincipalImpl(String s) {
          user = s;                                                                              user = s;
      }                                                                                      }

      public boolean equals(Object obj)                                                      public boolean equals(Object obj) {
          if(obj instanceof PrincipalImpl)                                                       if(obj instanceof PrincipalImpl) {
              PrincipalImpl principalimpl =                                                          PrincipalImpl principalimpl =
              (PrincipalImpl)obj;                                                                    (PrincipalImpl)obj;
              return user.equals(principalimpl.toString());                                          return user.equals(principalimpl.toString());
          } else                                                                                 } else {
              return false;                                                                          return false;
          }                                                                                      }
      }                                                                                      }

      public String toString()                                                               public String toString() {
          return user;                                                                           return user;
      }                                                                                      }

      public int hashCode()                                                                  public int hashCode() {
          return user.hashCode();                                                                return user.hashCode();
      }                                                                                      }

      public String getName()                                                                public String getName() {
          return user;                                                                           return user;
      }                                                                                      }

1 In the left column, the same declaration appears at the end of the class definition.

                                                                     PrincipalImpl synopsis -- page 2 of 3
    private String user;
}                                         }

                           PrincipalImpl synopsis -- page 3 of 3

Shared By: