Tabnine Logo
IndirectList
Code IndexAdd Tabnine to your IDE (free)

How to use
IndirectList
in
org.eclipse.persistence.indirection

Best Java code snippets using org.eclipse.persistence.indirection.IndirectList (Showing top 20 results out of 315)

origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Return a new Vector.
 */
public Object containerInstance() {
  return new IndirectList();
}
 
origin: org.eclipse.persistence/org.eclipse.persistence.core

protected void raiseAddChangeEvent(Object element, Integer index, boolean isSet) {
  if (hasTrackedPropertyChangeListener()) {
    _persistence_getPropertyChangeListener().propertyChange(new CollectionChangeEvent(this, getTrackedAttributeName(), this, element, CollectionChangeEvent.ADD, index, isSet, true));
  }
  if (isRelationshipMaintenanceRequired()) {
    ((UnitOfWorkQueryValueHolder)getValueHolder()).updateForeignReferenceSet(element, null);
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * @see java.util.Vector#addElement(java.lang.Object)
 */
@Override
public void addElement(E obj) {
  add(obj);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Return if any elements that have been added or removed before instantiation.
 */
public boolean hasDeferredChanges() {
  return hasRemovedElements() || hasAddedElements();
}
 
origin: com.haulmont.thirdparty/eclipselink

/**
 * @see java.util.Vector#add(int, java.lang.Object)
 */
@Override
public void add(int index, E element) {
  getDelegate().add(index, element);
  raiseAddChangeEvent(element, index);
}

origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Return if add/remove should trigger instantiation or avoid.
 * Current instantiation is avoided is using change tracking.
 */
protected boolean shouldAvoidInstantiation() {
  return (!isInstantiated())  && (shouldUseLazyInstantiation()) && (_persistence_getPropertyChangeListener() instanceof AttributeChangeListener) && !usesListOrderField() && ((WeavedAttributeValueHolderInterface)getValueHolder()).shouldAllowInstantiationDeferral();
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

Vector<E> newDelegate = (Vector<E>) getValueHolder().getValue();
if (newDelegate == null) {
  newDelegate = new Vector<>(this.initialCapacity, this.capacityIncrement);
  if(((IndirectList) newDelegate).isListOrderBrokenInDb()) {
    this.isListOrderBrokenInDb = true;
  newDelegate = ((IndirectList<E>) newDelegate).getDelegate();
if (hasAddedElements()) {
  for (E element: getAddedElements()) {
if (hasRemovedElements()) {
  for (E element: getRemovedElements()) {
    newDelegate.remove(element);
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * @see java.util.Vector#add(java.lang.Object)
 */
public boolean add(Object element) {
  if (!this.isRegistered) {
    return getDelegate().add(element);
  }
  boolean added = true;
  // PERF: If not instantiated just record the add to avoid the instantiation.
  if (shouldAvoidInstantiation()) {
    if (hasRemovedElements() && getRemovedElements().contains(element)) {
      getRemovedElements().remove(element);
    } else if (getAddedElements().contains(element)) {
      // Must avoid recursion for relationship maintenance.
      return false;
    } else {
      getAddedElements().add(element);
    }
  } else {
    added = getDelegate().add(element);
  }
  raiseAddChangeEvent(element, null);
  return added;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * @see java.util.Vector#remove(java.lang.Object)
 */
@Override
public boolean remove(Object element) {
  if (!this.isRegistered) {
    return getDelegate().remove(element);
  }
  // PERF: If not instantiated just record the removal to avoid the instantiation.
  if (shouldAvoidInstantiation()) {
    if (hasAddedElements() && getAddedElements().contains(element)) {
      getAddedElements().remove(element);
    } else if (getRemovedElements().contains(element)) {
      // Must avoid recursion for relationship maintenance.
      return false;
    } else {
      getRemovedElements().add((E) element);
    }
    this.raiseRemoveChangeEvent(element, null);
    return true;
  } else {
    int index = this.getDelegate().indexOf(element);
    if(index > -1) {
      this.getDelegate().remove(index);
      this.raiseRemoveChangeEvent(element, index);
      return true;
    }
  }
  return false;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * @see java.util.Vector#addAll(java.util.Collection)
 */
public boolean addAll(Collection c) {
  // Must trigger add events if tracked or uow.
  if (hasBeenRegistered() || hasTrackedPropertyChangeListener()) {
    Iterator objects = c.iterator();
    while (objects.hasNext()) {
      this.add(objects.next());
    }
    return true;
  }
  return getDelegate().addAll(c);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * PUBLIC:
 * @see java.util.Vector#contains(java.lang.Object)
 */
@Override
public boolean contains(Object element) {
  // PERF: Avoid instantiation if not required.
  if (hasAddedElements()) {
    if (getAddedElements().contains(element)) {
      return true;
    }
  }
  if (hasRemovedElements()) {
    if (getRemovedElements().contains(element)) {
      return false;
    }
  }
  return getDelegate().contains(element);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

protected void raiseRemoveChangeEvent(Object element, Integer index, boolean isSet) {
  if (hasTrackedPropertyChangeListener()) {
    _persistence_getPropertyChangeListener().propertyChange(new CollectionChangeEvent(this, getTrackedAttributeName(), this, element, CollectionChangeEvent.REMOVE, index, isSet));
  }
  if (hasBeenRegistered()) {
    ((UnitOfWorkQueryValueHolder)getValueHolder()).updateForeignReferenceRemove(element);
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Return the real collection object.
 * This will force instantiation.
 */
public Object getDelegateObject() {
  return getDelegate();
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

@Override
public synchronized void replaceAll(UnaryOperator<E> operator) {
  // Must trigger remove/add events if tracked or uow.
  if (hasBeenRegistered() || hasTrackedPropertyChangeListener()) {
    List<E> del = getDelegate();
    for (int i = 0; i < del.size(); i++) {
      set(i, operator.apply(del.get(i)));
    }
  } else {
    getDelegate().replaceAll(operator);
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * @see java.util.Vector#set(int, java.lang.Object)
 */
public Object set(int index, Object element) {
  Object oldValue = getDelegate().set(index, element);
  Integer bigIntIndex = new Integer(index);
  raiseRemoveChangeEvent(oldValue, bigIntIndex, true);
  raiseAddChangeEvent(element, bigIntIndex, true);
  return oldValue;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * @see java.util.Vector#remove(int)
 */
@Override
public E remove(int index) {
  E value = getDelegate().remove(index);
  this.raiseRemoveChangeEvent(value, index);
  return value;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * return whether this IndirectList has been registered with the UnitOfWork
 */
public boolean hasBeenRegistered() {
  return getValueHolder() instanceof UnitOfWorkQueryValueHolder;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Check whether the contents have been read from the database.
 * If they have not, read them and set the delegate.
 * This method used to be synchronized, which caused deadlock.
 */
protected Vector getDelegate() {
  if (delegate == null) {
    synchronized(this){
      if (delegate == null) {
        delegate = this.buildDelegate();
      }
    }
  }
  return delegate;
}    
 
origin: com.haulmont.thirdparty/eclipselink

Vector delegate = (Vector<E>)getValueHolder().getValue();
if (delegate == null) {
  delegate = new Vector<>(this.initialCapacity, this.capacityIncrement);
  if(((IndirectList) delegate).isListOrderBrokenInDb()) {
    this.isListOrderBrokenInDb = true;
  delegate = ((IndirectList) delegate).getDelegate();
if (hasAddedElements()) {
  int size = getAddedElements().size();
  for (int index = 0; index < size; index++) {
    Object element = ((List)getAddedElements()).get(index);
if (hasRemovedElements()) {
  int size = getRemovedElements().size();
  for (int index = 0; index < size; index++) {
    delegate.remove(((List)getRemovedElements()).get(index));
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * @see java.util.Vector#add(java.lang.Object)
 */
@Override
public boolean add(E element) {
  if (!this.isRegistered) {
    return getDelegate().add(element);
  }
  boolean added = true;
  // PERF: If not instantiated just record the add to avoid the instantiation.
  if (shouldAvoidInstantiation()) {
    if (hasRemovedElements() && getRemovedElements().contains(element)) {
      getRemovedElements().remove(element);
    } else if (isRelationshipMaintenanceRequired() && getAddedElements().contains(element)) {
      // Must avoid recursion for relationship maintenance.
      return false;
    } else {
      getAddedElements().add(element);
    }
  } else {
    added = getDelegate().add(element);
  }
  raiseAddChangeEvent(element, null);
  return added;
}
org.eclipse.persistence.indirectionIndirectList

Javadoc

IndirectList allows a domain class to take advantage of TopLink indirection without having to declare its instance variable as a ValueHolderInterface.

To use an IndirectList:

  • Declare the appropriate instance variable with type Collection/List/Vector (jdk1.2).
  • Send the message #useTransparentCollection() to the appropriate CollectionMapping.
EclipseLink will place an IndirectList in the instance variable when the containing domain object is read from the database. With the first message sent to the IndirectList, the contents are fetched from the database and normal Collection/List/Vector behavior is resumed.

Most used methods

  • <init>
    PUBLIC: Construct an IndirectList containing the elements of the specified collection, in the order
  • _persistence_getPropertyChangeListener
    INTERNAL: Return the property change listener for change tracking.
  • add
  • buildDelegate
    INTERNAL: Return the freshly-built delegate.
  • getAddedElements
    INTERNAL: Return the elements that have been added before instantiation.
  • getDelegate
    INTERNAL: Check whether the contents have been read from the database. If they have not, read them a
  • getRemovedElements
    INTERNAL: Return the elements that have been removed before instantiation.
  • getTrackedAttributeName
    INTERNAL: Return the mapping attribute name, used to raise change events.
  • getValueHolder
    INTERNAL: Return the valueHolder. This method used to be synchronized, which caused deadlock.
  • hasAddedElements
    INTERNAL: Return if any elements that have been added before instantiation.
  • hasBeenRegistered
    INTERNAL: return whether this IndirectList has been registered with the UnitOfWork
  • hasRemovedElements
    INTERNAL: Return if any elements that have been removed before instantiation.
  • hasBeenRegistered,
  • hasRemovedElements,
  • hasTrackedPropertyChangeListener,
  • isInstantiated,
  • isListOrderBrokenInDb,
  • iterator,
  • listIterator,
  • raiseAddChangeEvent,
  • raiseRemoveChangeEvent,
  • remove

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onCreateOptionsMenu (Activity)
  • onRequestPermissionsResult (Fragment)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Path (java.nio.file)
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • JList (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now