Methods Summary |
---|
protected java.util.Hashtable | buildDelegate()Return the freshly-built delegate.
return (Hashtable)getValueHolder().getValue();
|
public synchronized void | clear()
this.getDelegate().clear();
|
public synchronized java.lang.Object | clone()
IndirectMap result = (IndirectMap)super.clone();
result.delegate = (Hashtable)this.getDelegate().clone();
return result;
|
public synchronized boolean | contains(java.lang.Object value)
return this.getDelegate().contains(value);
|
public synchronized boolean | containsKey(java.lang.Object key)
return this.getDelegate().containsKey(key);
|
public boolean | containsValue(java.lang.Object value)
return this.getDelegate().containsValue(value);
|
public synchronized java.util.Enumeration | elements()
return this.getDelegate().elements();
|
public java.util.Set | entrySet()
return new Set (){
Set delegateSet = IndirectMap.this.getDelegate().entrySet();
public int size(){
return this.delegateSet.size();
}
public boolean isEmpty(){
return this.delegateSet.isEmpty();
}
public boolean contains(Object o){
return this.delegateSet.contains(o);
}
public Iterator iterator(){
return new Iterator() {
Iterator delegateIterator = delegateSet.iterator();
Object currentObject;
public boolean hasNext() {
return this.delegateIterator.hasNext();
}
public Object next() {
this.currentObject = this.delegateIterator.next();
return this.currentObject;
}
public void remove() {
raiseRemoveChangeEvent(((Map.Entry)currentObject).getKey(), ((Map.Entry)currentObject).getValue());
this.delegateIterator.remove();
}
};
}
public Object[] toArray(){
return this.delegateSet.toArray();
}
public Object[] toArray(Object a[]){
return this.delegateSet.toArray(a);
}
public boolean add(Object o){
return this.delegateSet.add(o);
}
public boolean remove(Object o){
if (!(o instanceof Map.Entry)) {
return false;
}
return (IndirectMap.this.remove(((Map.Entry)o).getKey()) != null);
}
public boolean containsAll(Collection c){
return this.delegateSet.containsAll(c);
}
public boolean addAll(Collection c){
return this.delegateSet.addAll(c);
}
public boolean retainAll(Collection c){
boolean result = false;
Iterator objects = delegateSet.iterator();
while (objects.hasNext()) {
Map.Entry object = (Map.Entry)objects.next();
if (!c.contains(object)) {
objects.remove();
raiseRemoveChangeEvent(object.getKey(), object.getValue());
result = true;
}
}
return result;
}
public boolean removeAll(Collection c){
boolean result = false;
for (Iterator cs = c.iterator(); cs.hasNext(); ){
Object object = cs.next();
if ( ! (object instanceof Map.Entry)){
continue;
}
Object removed = IndirectMap.this.remove(((Map.Entry)object).getKey());
if (removed != null){
result = true;
}
}
return result;
}
public void clear(){
IndirectMap.this.clear();
}
public boolean equals(Object o){
return this.delegateSet.equals(o);
}
public int hashCode(){
return this.delegateSet.hashCode();
}
};
|
public synchronized boolean | equals(java.lang.Object o)
return this.getDelegate().equals(o);
|
public synchronized java.lang.Object | get(java.lang.Object key)
return this.getDelegate().get(key);
|
protected synchronized java.util.Hashtable | 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 synchronized oracle.toplink.essentials.indirection.ValueHolderInterface | getValueHolder()PUBLIC:
Return the valueHolder.
// PERF: lazy initialize value holder and vector as are normally set after creation.
if (valueHolder == null) {
valueHolder = new ValueHolder(new Hashtable(initialCapacity, loadFactor));
}
return valueHolder;
|
public synchronized int | hashCode()
return this.getDelegate().hashCode();
|
protected void | initialize(int initialCapacity, float loadFactor)Initialize the instance.
this.delegate = null;
this.loadFactor = loadFactor;
this.initialCapacity = initialCapacity;
this.valueHolder = null;
|
protected void | initialize(java.util.Map m)Initialize the instance.
this.delegate = null;
Hashtable temp = new Hashtable(m);
this.valueHolder = new ValueHolder(temp);
|
public boolean | isEmpty()
return this.getDelegate().isEmpty();
|
public boolean | isInstantiated()PUBLIC:
Return whether the contents have been read from the database.
return this.getValueHolder().isInstantiated();
|
public java.util.Set | keySet()
return new Set (){
Set delegateSet = IndirectMap.this.getDelegate().keySet();
public int size(){
return this.delegateSet.size();
}
public boolean isEmpty(){
return this.delegateSet.isEmpty();
}
public boolean contains(Object o){
return this.delegateSet.contains(o);
}
public Iterator iterator(){
return new Iterator() {
Iterator delegateIterator = delegateSet.iterator();
Object currentObject;
public boolean hasNext() {
return this.delegateIterator.hasNext();
}
public Object next() {
this.currentObject = this.delegateIterator.next();
return this.currentObject;
}
public void remove() {
IndirectMap.this.raiseRemoveChangeEvent(currentObject, IndirectMap.this.getDelegate().get(currentObject));
this.delegateIterator.remove();
}
};
}
public Object[] toArray(){
return this.delegateSet.toArray();
}
public Object[] toArray(Object a[]){
return this.delegateSet.toArray(a);
}
public boolean add(Object o){
return this.delegateSet.add(o);
}
public boolean remove(Object o){
return (IndirectMap.this.remove(o) != null);
}
public boolean containsAll(Collection c){
return this.delegateSet.containsAll(c);
}
public boolean addAll(Collection c){
return this.delegateSet.addAll(c);
}
public boolean retainAll(Collection c){
boolean result = false;
Iterator objects = delegateSet.iterator();
while (objects.hasNext()) {
Object object = objects.next();
if (!c.contains(object)) {
objects.remove();
IndirectMap.this.raiseRemoveChangeEvent(object, IndirectMap.this.getDelegate().get(object));
result = true;
}
}
return result;
}
public boolean removeAll(Collection c){
boolean result = false;
for (Iterator cs = c.iterator(); cs.hasNext(); ){
if (IndirectMap.this.remove(cs.next()) != null ) {
result = true;
}
}
return result;
}
public void clear(){
IndirectMap.this.clear();
}
public boolean equals(Object o){
return this.delegateSet.equals(o);
}
public int hashCode(){
return this.delegateSet.hashCode();
}
};
|
public synchronized java.util.Enumeration | keys()
return this.getDelegate().keys();
|
public synchronized java.lang.Object | put(java.lang.Object key, java.lang.Object value)
Object oldValue = this.getDelegate().put(key, value);
if (oldValue != null){
raiseRemoveChangeEvent(key, oldValue);
}
raiseAddChangeEvent(key, value);
return oldValue;
|
public synchronized void | putAll(java.util.Map t)
this.getDelegate().putAll(t);
|
protected void | raiseAddChangeEvent(java.lang.Object key, java.lang.Object value)Raise the add change event and relationship maintainence.
// this is where relationship maintenance would go
|
protected void | raiseRemoveChangeEvent(java.lang.Object key, java.lang.Object value)Raise the remove change event.
// this is where relationship maintenance would go
|
protected void | rehash()
throw new InternalError("unsupported");
|
public synchronized java.lang.Object | remove(java.lang.Object key)
Object value = this.getDelegate().remove(key);
if (value != null){
raiseRemoveChangeEvent(key, value);
}
return value;
|
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)PUBLIC:
Set the value holder.
this.delegate = null;
this.valueHolder = valueHolder;
|
public int | size()
return this.getDelegate().size();
|
public java.lang.String | toString()PUBLIC:
Use the Hashtable.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()) + ": not instantiated}";
}
|
public java.util.Collection | values()
return new Collection() {
protected Collection delegateCollection = IndirectMap.this.getDelegate().values();
public int size(){
return delegateCollection.size();
}
public boolean isEmpty(){
return delegateCollection.isEmpty();
}
public boolean contains(Object o){
return delegateCollection.contains(o);
}
public Iterator iterator() {
return new Iterator() {
Iterator delegateIterator = delegateCollection.iterator();
Object currentObject;
public boolean hasNext() {
return this.delegateIterator.hasNext();
}
public Object next() {
this.currentObject = this.delegateIterator.next();
return this.currentObject;
}
public void remove() {
Iterator iterator = IndirectMap.this.getDelegate().entrySet().iterator();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry)iterator.next();
if (entry.getValue().equals(currentObject)){
IndirectMap.this.raiseRemoveChangeEvent(entry.getKey(), entry.getValue());
}
}
this.delegateIterator.remove();
}
};
}
public Object[] toArray(){
return this.delegateCollection.toArray();
}
public Object[] toArray(Object a[]){
return this.delegateCollection.toArray(a);
}
public boolean add(Object o){
return this.delegateCollection.add(o);
}
public boolean remove(Object o){
Iterator iterator = IndirectMap.this.getDelegate().entrySet().iterator();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry)iterator.next();
if (entry.getValue().equals(o)){
IndirectMap.this.raiseRemoveChangeEvent(entry.getKey(), entry.getValue());
}
return true;
}
return false;
}
public boolean containsAll(Collection c){
return this.delegateCollection.containsAll(c);
}
public boolean addAll(Collection c){
return this.delegateCollection.addAll(c);
}
public boolean removeAll(Collection c){
boolean result = false;
for (Iterator iterator = c.iterator(); iterator.hasNext();){
if (remove(iterator.next()) ){
result = true;
}
}
return result;
}
public boolean retainAll(Collection c){
boolean result = false;
for (Iterator iterator = IndirectMap.this.entrySet().iterator(); iterator.hasNext();){
Map.Entry entry = (Map.Entry)iterator.next();
if (! c.contains(entry.getValue()) ) {
iterator.remove();
result = true;
}
}
return result;
}
public void clear(){
IndirectMap.this.clear();
}
public boolean equals(Object o){
return this.delegateCollection.equals(o);
}
public int hashCode(){
return this.delegateCollection.hashCode();
}
};
|