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

How to use
DescriptorIterator
in
org.eclipse.persistence.internal.descriptors

Best Java code snippets using org.eclipse.persistence.internal.descriptors.DescriptorIterator (Showing top 20 results out of 315)

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

public boolean shouldCascadeAllParts() {
  return getCascadeDepth() == CascadeAllParts;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * This is the root method called to start the iteration.
 */
public void startIterationOn(Object sourceObject) {
  if (getVisitedObjects().containsKey(sourceObject)) {
    return;
  }
  getVisitedObjects().put(sourceObject, sourceObject);
  setCurrentMapping(null);
  setCurrentDescriptor(getSession().getDescriptor(sourceObject));
  iterate(sourceObject);
  // start the recursion
  if ((getCurrentDescriptor() != null) && (!shouldCascadeNoParts())  && !this.shouldBreak()) {
    iterateReferenceObjects(sourceObject);
  }
}
 
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Iterate on the appropriate attribute.
 */
@Override
public void iterate(DescriptorIterator iterator) {
  // PERF: Only iterate when required.
  if (iterator.shouldIterateOnPrimitives()) {
    iterator.iteratePrimitiveForMapping(getAttributeValueFromObject(iterator.getVisitedParent()), this);
  }
}

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

/**
 * Iterate on the primitive value for its mapping.
 */
public void iteratePrimitiveForMapping(Object primitiveValue, DatabaseMapping mapping) {
  if (primitiveValue == null) {
    return;
  }
  setCurrentMapping(mapping);
  setCurrentDescriptor(null);
  if (shouldIterateOnPrimitives()) {// false by default
    internalIteratePrimitive(primitiveValue);
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Iterate on the mapping's reference object and
 * recursively iterate on the reference object's
 * reference objects.
 * This is used for aggregate and aggregate collection mappings, which are not iterated on by default.
 */
public void iterateForAggregateMapping(Object aggregateObject, DatabaseMapping mapping, ClassDescriptor descriptor) {
  if (aggregateObject == null) {
    return;
  }
  setCurrentMapping(mapping);
  // aggregate descriptors are passed in because they could be part of an inheritance tree
  setCurrentDescriptor(descriptor);
  if (shouldIterateOnAggregates()) {// false by default
    internalIterateAggregateObject(aggregateObject);
    if (shouldBreak()) {
      setShouldBreak(false);
      return;
    }
  }
  iterateReferenceObjects(aggregateObject);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

if ((!shouldIterateOverWrappedObjects()) && (rd != null) && (rd.hasWrapperPolicy())) {
  return;
if (getVisitedObjects().containsKey(referenceObject)) {
  return;
getVisitedObjects().put(referenceObject, referenceObject);
setCurrentMapping(mapping);
setCurrentDescriptor(getDescriptorFor(referenceObject));
internalIterateReferenceObject(referenceObject);
if (shouldBreak()) {
  setShouldBreak(false);
  return;
iterateReferenceObjects(referenceObject);
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Iterate on the indirection object for its mapping.
 */
public void iterateIndirectContainerForMapping(IndirectContainer container, DatabaseMapping mapping) {
  setCurrentMapping(mapping);
  setCurrentDescriptor(null);
  if (shouldIterateOnIndirectionObjects()) {// false by default
    internalIterateIndirectContainer(container);
  }
  if (shouldIterateOverUninstantiatedIndirectionObjects() || (shouldIterateOverIndirectionObjects() && container.isInstantiated())) {
    // force instantiation only if specified
    mapping.iterateOnRealAttributeValue(this, container);
  } else if (shouldIterateOverIndirectionObjects()) {
    // PERF: Allow the indirect container to iterate any cached elements.
    if (container instanceof IndirectCollection)  {
      mapping.iterateOnRealAttributeValue(this, ((IndirectCollection)container).getAddedElements());
    }
  }
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Iterate on the appropriate attribute value.
 */
public void iterate(DescriptorIterator iterator) {
  // PERF: Only iterate when required.
  if (iterator.shouldIterateOnPrimitives()) {
    Object attributeValue = this.getAttributeValueFromObject(iterator.getVisitedParent());
    if (attributeValue == null) {
      return;
    }
    ContainerPolicy cp = this.getContainerPolicy();
    for (Object iter = cp.iteratorFor(attributeValue); cp.hasNext(iter);) {
      iterator.iteratePrimitiveForMapping(cp.next(iter, iterator.getSession()), this);
    }
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Iterate on the specified attribute value.
 */
protected void iterateOnAttributeValue(DescriptorIterator iterator, Object attributeValue) {
  iterator.iterateForAggregateMapping(attributeValue, this, getReferenceDescriptor(attributeValue, iterator.getSession()));
}
origin: com.haulmont.thirdparty/eclipselink

protected void internalIterateReferenceObjects(Object sourceObject) {
  List<DatabaseMapping> mappings;
  if (shouldIterateOnPrimitives()) {
    mappings = getCurrentDescriptor().getObjectBuilder().getDescriptor().getMappings();
  } else {
    ObjectBuilder builder = getCurrentDescriptor().getObjectBuilder().getDescriptor().getObjectBuilder();
  if (shouldIterateOnFetchGroupAttributesOnly()) {
    if(getCurrentDescriptor().hasFetchGroupManager()) {
      FetchGroup fetchGroup = getCurrentDescriptor().getFetchGroupManager().getObjectFetchGroup(sourceObject);
      if (fetchGroup != null) {
        List<DatabaseMapping> fetchGroupMappings = new ArrayList();
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Fetch and return the descriptor for the specified object.
 */
protected ClassDescriptor getDescriptorFor(Object object) {
  ClassDescriptor result = getSession().getDescriptor(object);
  if (result == null) {
    throw DescriptorException.missingDescriptor(object.getClass().getName());
  }
  return result;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Iterate on the attribute value.
 * The value holder has already been processed.
 */
@Override
public void iterateOnRealAttributeValue(DescriptorIterator iterator, Object realAttributeValue) {
  // This may be wrapped as the caller in iterate on foreign reference does not unwrap as the type is generic.
  Object unwrappedAttributeValue = getReferenceDescriptor().getObjectBuilder().unwrapObject(realAttributeValue, iterator.getSession());
  iterator.iterateReferenceObjectForMapping(unwrappedAttributeValue, this);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Iterate on the attribute value.
 * The value holder has already been processed.
 * PERF: Avoid iteration if not required.
 */
public void iterateOnRealAttributeValue(DescriptorIterator iterator, Object realAttributeValue) {
  super.iterateOnRealAttributeValue(iterator, realAttributeValue);
  ContainerPolicy cp = getContainerPolicy();
  if (realAttributeValue != null && !iterator.shouldIterateOnPrimitives()) {
    for (Object iter = cp.iteratorFor(realAttributeValue); cp.hasNext(iter);) {
      Object wrappedObject = cp.nextEntry(iter, iterator.getSession());
      cp.iterateOnMapKey(iterator, wrappedObject);
    }
  }
}
 
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Perform the iteration opperation on the iterators current objects attributes.
 * Only require if primitives are desired.
 */
@Override
public void iterate(DescriptorIterator iterator) {
  Object attributeValue = getAttributeValueFromObject(iterator.getVisitedParent());
  this.indirectionPolicy.iterateOnAttributeValue(iterator, attributeValue);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Iterate over the sourceObject's reference objects,
 * updating the visited stack appropriately.
 */
protected void iterateReferenceObjects(Object sourceObject) {
  getVisitedStack().push(sourceObject);
  getCurrentDescriptor().getObjectBuilder().iterate(this);
  getVisitedStack().pop();
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Return the second-to-last object visited.
 */
public Object getVisitedGrandparent() {
  Object parent = getVisitedStack().pop();
  Object result = getVisitedStack().peek();
  getVisitedStack().push(parent);
  return result;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Iterate over the sourceObject's reference objects,
 * updating the visited stack appropriately.
 */
protected void iterateReferenceObjects(Object sourceObject) {
  if(this.usesGroup) {
    // object is outside of the group - don't iterate over its references
    if(this.currentGroup == null || !this.currentGroup.hasItems()) {
      return;
    }
  }
  getVisitedStack().push(sourceObject);
  internalIterateReferenceObjects(sourceObject);
  getVisitedStack().pop();
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

if ((!shouldIterateOverWrappedObjects()) && (rd != null) && (rd.hasWrapperPolicy())) {
  return;
  Set visited = (Set)getVisitedObjects().get(referenceObject);
  if(visited == null) {
    visited = new HashSet(1);
    visited.add(this.currentItem.getGroup());
    getVisitedObjects().put(referenceObject, visited);
  } else {
    if(visited.contains(this.currentItem.getGroup())) {
  if (getVisitedObjects().containsKey(referenceObject)) {
    return;
  getVisitedObjects().put(referenceObject, referenceObject);
setCurrentMapping(mapping);
setCurrentDescriptor(getDescriptorFor(referenceObject));
internalIterateReferenceObject(referenceObject);
if (shouldBreak()) {
  setShouldBreak(false);
  if(this.usesGroup) {
    this.currentGroup = currentGroupOriginal;
iterateReferenceObjects(referenceObject);
if(this.usesGroup) {
  this.currentGroup = currentGroupOriginal;
origin: org.eclipse.persistence/org.eclipse.persistence.core

  return;
setCurrentMapping(mapping);
setCurrentDescriptor(descriptor);
if (shouldIterateOnAggregates()) {// false by default
  internalIterateAggregateObject(aggregateObject);
  if (shouldBreak()) {
    setShouldBreak(false);
    if(this.usesGroup) {
      this.currentGroup = currentGroupOriginal;
iterateReferenceObjects(aggregateObject);
if(this.usesGroup) {
  this.currentGroup = currentGroupOriginal;
origin: com.haulmont.thirdparty/eclipselink

/**
 * Iterate on the indirection object for its mapping.
 */
public void iterateIndirectContainerForMapping(IndirectContainer container, DatabaseMapping mapping) {
  setCurrentMapping(mapping);
  setCurrentDescriptor(null);
  if (shouldIterateOnIndirectionObjects()) {// false by default
    internalIterateIndirectContainer(container);
  }
  if (shouldIterateOverUninstantiatedIndirectionObjects() || (shouldIterateOverIndirectionObjects() && container.isInstantiated())) {
    // force instantiation only if specified
    mapping.iterateOnRealAttributeValue(this, container);
  } else if (shouldIterateOverIndirectionObjects()) {
    // PERF: Allow the indirect container to iterate any cached elements.
    if (container instanceof IndirectCollection)  {
      mapping.iterateOnRealAttributeValue(this, ((IndirectCollection)container).getAddedElements());
    }
  }
}
org.eclipse.persistence.internal.descriptorsDescriptorIterator

Javadoc

This class provides a generic way of using the descriptor information to traverse an object graph. Define a subclass, or an inner class, that implements at least #iterate(Object) to implement a new traversal feature without having to change the mapping classes or the object builder. It provides functionality such as a cascading depth, a stack of visited object, and a collection of the visited objects. NOTE: If this works nicely the merge manager, remote traversals, and maybe even aspects of the commit manager could be converted to use this class.

Most used methods

  • getCascadeDepth
  • getCurrentDescriptor
  • getDescriptorFor
    Fetch and return the descriptor for the specified object.
  • getSession
  • getVisitedObjects
  • getVisitedParent
    Return the last object visited.
  • getVisitedStack
  • internalIterateAggregateObject
    Iterate an aggregate object (i.e. an object that is the target of an AggregateMapping). Override thi
  • internalIterateIndirectContainer
    Iterate an indirect container (IndirectList or IndirectMap). Override this method if appropriate.
  • internalIteratePrimitive
    Iterate a primitive object (String, Date, Integer, etc.). Override this method if appropriate.
  • internalIterateReferenceObject
    Iterate a (a non-Aggregate) reference object. Override this method if appropriate.
  • internalIterateValueHolder
    Iterate a value holder. Override this method if appropriate.
  • internalIterateReferenceObject,
  • internalIterateValueHolder,
  • iterate,
  • iterateForAggregateMapping,
  • iterateIndirectContainerForMapping,
  • iteratePrimitiveForMapping,
  • iterateReferenceObjectForMapping,
  • iterateReferenceObjects,
  • iterateValueHolderForMapping,
  • setCascadeCondition

Popular in Java

  • Making http post requests using okhttp
  • setScale (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • runOnUiThread (Activity)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JFrame (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top plugins for WebStorm
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