Methods Summary |
---|
public synchronized boolean | add(java.lang.Object o)
this.getDelegate().add(o);
this.raiseAddChangeEvent(o);
return true;
|
public synchronized boolean | addAll(java.util.Collection c)
// Must trigger add events if tracked or uow.
if (hasBeenRegistered()) {
Iterator objects = c.iterator();
while (objects.hasNext()) {
this.add(objects.next());
}
return true;
}
return getDelegate().addAll(c);
|
protected java.util.Set | buildDelegate()Return the freshly-built delegate.
return (Set)getValueHolder().getValue();
|
public void | clear()
if (hasBeenRegistered()) {
Iterator objects = this.iterator();
while (objects.hasNext()) {
Object o = objects.next();
objects.remove();
this.raiseRemoveChangeEvent(o);
}
} else {
this.getDelegate().clear();
}
|
public java.lang.Object | clone()
try {
IndirectSet result = (IndirectSet)super.clone();
result.delegate = this.cloneDelegate();
result.attributeName = null;
return result;
} catch (CloneNotSupportedException e) {
throw new InternalError("clone not supported");
}
|
protected java.util.Set | cloneDelegate()Clone the delegate.
java.lang.reflect.Method cloneMethod;
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
cloneMethod = (Method)AccessController.doPrivileged(new PrivilegedGetMethod(this.getDelegate().getClass(), "clone", (Class[])null, false));
} catch (PrivilegedActionException exception) {
throw QueryException.cloneMethodRequired();
}
} else {
cloneMethod = PrivilegedAccessHelper.getMethod(this.getDelegate().getClass(), "clone", (Class[])null, false);
}
} catch (NoSuchMethodException ex) {
throw QueryException.cloneMethodRequired();
}
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
return (Set)AccessController.doPrivileged(new PrivilegedMethodInvoker(cloneMethod, this.getDelegate(), (Object[])null));
} catch (PrivilegedActionException exception) {
Exception throwableException = exception.getException();
if (throwableException instanceof IllegalAccessException) {
throw QueryException.cloneMethodInaccessible();
} else {
throw QueryException.cloneMethodThrowException(((java.lang.reflect.InvocationTargetException)throwableException).getTargetException());
}
}
} else {
return (Set)PrivilegedAccessHelper.invokeMethod(cloneMethod, this.getDelegate(), (Object[])null);
}
} catch (IllegalAccessException ex1) {
throw QueryException.cloneMethodInaccessible();
} catch (java.lang.reflect.InvocationTargetException ex2) {
throw QueryException.cloneMethodThrowException(ex2.getTargetException());
}
|
public boolean | contains(java.lang.Object o)
return this.getDelegate().contains(o);
|
public boolean | containsAll(java.util.Collection c)
return this.getDelegate().containsAll(c);
|
public boolean | equals(java.lang.Object o)
return this.getDelegate().equals(o);
|
protected java.util.Set | getDelegate()Check whether the contents have been read from the database.
If they have not, read them and set the delegate.
if (delegate == null) {
delegate = this.buildDelegate();
}
return delegate;
|
public java.lang.String | getTopLinkAttributeName()Return the mapping attribute name, used to raise change events.
return attributeName;
|
public oracle.toplink.essentials.indirection.ValueHolderInterface | getValueHolder()Return the valueHolder.
// PERF: lazy initialize value holder and vector as are normally set after creation.
if (valueHolder == null) {
valueHolder = new ValueHolder(new HashSet(initialCapacity, loadFactor));
}
return valueHolder;
|
public boolean | hasBeenRegistered()INTERNAL:
Return whether this IndirectSet has been registered in a UnitOfWork
return getValueHolder() instanceof oracle.toplink.essentials.internal.indirection.UnitOfWorkQueryValueHolder;
|
public int | hashCode()
return this.getDelegate().hashCode();
|
public boolean | isEmpty()
return this.getDelegate().isEmpty();
|
public boolean | isInstantiated()Return whether the contents have been read from the database.
return this.getValueHolder().isInstantiated();
|
public java.util.Iterator | iterator()
// Must wrap the interator to raise the remove event.
return new Iterator() {
Iterator delegateIterator = IndirectSet.this.getDelegate().iterator();
Object currentObject;
public boolean hasNext() {
return this.delegateIterator.hasNext();
}
public Object next() {
this.currentObject = this.delegateIterator.next();
return this.currentObject;
}
public void remove() {
this.delegateIterator.remove();
IndirectSet.this.raiseRemoveChangeEvent(this.currentObject);
}
};
|
protected void | raiseAddChangeEvent(java.lang.Object element)Raise the add change event and relationship maintainence.
if (hasBeenRegistered()) {
((UnitOfWorkQueryValueHolder)getValueHolder()).updateForeignReferenceSet(element, null);
}
|
protected void | raiseRemoveChangeEvent(java.lang.Object element)Raise the remove change event.
if (hasBeenRegistered()) {
((UnitOfWorkQueryValueHolder)getValueHolder()).updateForeignReferenceRemove(element);
}
|
public synchronized boolean | remove(java.lang.Object o)
if (this.getDelegate().remove(o)) {
this.raiseRemoveChangeEvent(o);
return true;
}
return false;
|
public synchronized boolean | removeAll(java.util.Collection c)
// Must trigger remove events if tracked or uow.
if (hasBeenRegistered()) {
Iterator objects = c.iterator();
while (objects.hasNext()) {
this.remove(objects.next());
}
return true;
}
return this.getDelegate().removeAll(c);
|
public synchronized boolean | retainAll(java.util.Collection c)
// Must trigger remove events if tracked or uow.
if (hasBeenRegistered()) {
Iterator objects = getDelegate().iterator();
while (objects.hasNext()) {
Object object = objects.next();
if (!c.contains(object)) {
objects.remove();
this.raiseRemoveChangeEvent(object);
}
}
return true;
}
return this.getDelegate().retainAll(c);
|
public void | setTopLinkAttributeName(java.lang.String attributeName)Set the mapping attribute name, used to raise change events.
This is required if the change listener is set.
this.attributeName = attributeName;
|
public void | setValueHolder(oracle.toplink.essentials.indirection.ValueHolderInterface valueHolder)Set the value holder.
Note that the delegate must be cleared out.
this.delegate = null;
this.valueHolder = valueHolder;
|
public int | size()
return this.getDelegate().size();
|
public java.lang.Object[] | toArray()
return this.getDelegate().toArray();
|
public java.lang.Object[] | toArray(java.lang.Object[] a)
return this.getDelegate().toArray(a);
|
public java.lang.String | toString()Use the delegate's #toString(); but wrap it with braces to indicate
there is a bit of indirection.
Don't allow this method to trigger a database read.
if (ValueHolderInterface.shouldToStringInstantiate) {
return this.getDelegate().toString();
}
if (this.isInstantiated()) {
return "{" + this.getDelegate().toString() + "}";
} else {
return "{" + oracle.toplink.essentials.internal.helper.Helper.getShortClassName(this.getClass()) + ": " + ToStringLocalization.buildMessage("not_instantiated", (Object[])null) + "}";
}
|