/* * Copyright 2005-2010 the original author or authors. * * 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 org.wamblee.general; /** * This class provided an equality operation based on the object reference of * the wrapped object. This is required because we cannto assume that the equals * operation has any meaning for different types of persistent objects. This * allows us to use the standard collection classes for detecting cyclic * dependences and avoiding recursion. */ public class ObjectElem { private Object object; /** * Constructs the wrapper. * * @param aObject * Object. */ public ObjectElem(Object aObject) { object = aObject; } public boolean equals(Object aObj) { if (aObj == null) { return false; } if (!(aObj instanceof ObjectElem)) { return false; } return ((ObjectElem) aObj).object == object; } public int hashCode() { return object.hashCode(); } }