Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2014-2015 Philip Helger (www.helger.com) philip[at]helger[dot]com Licensed 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 com.helger.appbasics.object.accarea;
 
 
 
 
 public abstract class AbstractAccountingAreaObject extends AbstractBaseObject implements IAccountingAreaObject
 {
   private final IClient m_aClient;
   private final IAccountingArea m_aAccountingArea;
   private Integer m_aHashCode;
 
   protected AbstractAccountingAreaObject (@Nonnull final IAccountingAreaObject aOther)
   {
     super (aOther);
      = aOther.getClient ();
      = aOther.getAccountingArea ();
   }
 
   public AbstractAccountingAreaObject (@Nonnull final IAccountingArea aAccountingArea, @Nonnull final StubObject aObject)
   {
     this (aAccountingArea.getClient (), aAccountingAreaaObject);
   }
 
   public AbstractAccountingAreaObject (@Nonnull final IClient aClient,
                                        @Nonnull final IAccountingArea aAccountingArea,
                                        @Nonnull final StubObject aObject)
   {
     super (aObject);
     ValueEnforcer.notNull (aClient"Client");
     ValueEnforcer.notNull (aAccountingArea"AccountingArea");
     if (!aAccountingArea.hasSameClient (aClient))
       throw new IllegalArgumentException ("The passed accounting area '" +
                                           aAccountingArea.getID () +
                                           "' does not belong to the passed client '" +
                                           aClient.getID () +
                                           "'!");
 
      = aClient;
      = aAccountingArea;
   }
 
   public AbstractAccountingAreaObject (@Nonnull final IClient aClient,
                                        @Nonnull final IAccountingArea aAccountingArea,
                                        @Nonnull @Nonempty final String sID,
                                        @Nonnull final DateTime aCreationDT,
                                        @Nullable final String sCreationUserID,
                                        @Nullable final DateTime aLastModificationDT,
                                        @Nullable final String sLastModificationUserID,
                                        @Nullable final DateTime aDeletionDT,
                                        @Nullable final String sDeletionUserID)
   {
     super (sID,
            aCreationDT,
            sCreationUserID,
            aLastModificationDT,
            sLastModificationUserID,
            aDeletionDT,
            sDeletionUserID);
     ValueEnforcer.notNull (aClient"Client");
     ValueEnforcer.notNull (aAccountingArea"AccountingArea");
     if (!aAccountingArea.hasSameClient (aClient))
       throw new IllegalArgumentException ("The passed accounting area '" +
                                           aAccountingArea.getID () +
                                           "' does not belong to the passed client '" +
                                           aClient.getID () +
                                           "'!");
 
      = aClient;
      = aAccountingArea;
   }
  public final String getClientID ()
  {
    return .getID ();
  }
  public final IClient getClient ()
  {
    return ;
  }
  public final boolean hasSameClientID (@Nullable final IClientObject aClientObject)
  {
    return aClientObject != null && hasSameClientID (aClientObject.getClientID ());
  }
  public final boolean hasSameClientID (@Nullable final String sClientID)
  {
    return .getID ().equals (sClientID);
  }
  public boolean hasSameClient (@Nullable final IClient aClient)
  {
    return .equals (aClient);
  }
  public final String getAccountingAreaID ()
  {
    return .getID ();
  }
  public final IAccountingArea getAccountingArea ()
  {
    return ;
  }
  public final boolean hasSameClientAndAccountingAreaID (@Nullable final IAccountingArea aAccountingArea)
  {
    return aAccountingArea != null &&
           hasSameClientID (aAccountingArea) &&
           .getID ().equals (aAccountingArea.getID ());
  }
  public final boolean hasSameClientAndAccountingAreaID (@Nullable final IAccountingAreaObject aAccountingAreaObject)
  {
    return aAccountingAreaObject != null &&
           hasSameClientID (aAccountingAreaObject) &&
           .getID ().equals (aAccountingAreaObject.getAccountingAreaID ());
  }
  public final boolean equals (final Object o)
  {
    if (o == this)
      return true;
    if (o == null || !getClass ().equals (o.getClass ()))
      return false;
    return .equals (rhs.m_aClient) &&
           .equals (rhs.m_aAccountingArea) &&
           getID ().equals (rhs.getID ());
  }
  public final int hashCode ()
  {
    Integer aObj = ;
    if (aObj == null)
    {
      aObj = new HashCodeGenerator (this).append ()
                                         .append ()
                                         .append (getID ())
                                         .getHashCodeObj ();
       = aObj;
    }
    return aObj.intValue ();
  }
  public String toString ()
  {
    return ToStringGenerator.getDerived (super.toString ())
                            .append ("client")
                            .append ("accoutingArea")
                            .toString ();
  }
New to GrepCode? Check out our FAQ X