/** INTERNAL: Create a new policy. Only descriptor involved in interface should have a policy. */
 public InterfacePolicy() {
   this.childDescriptors =
       org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance();
   this.parentInterfaces =
       org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(2);
   this.parentInterfaceNames =
       org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(2);
   this.parentDescriptors =
       org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(2);
 }
  /**
   * INTERNAL: This methods clones all the fields and ensures that each collection refers to the
   * same clones.
   */
  @Override
  public Object clone() {
    VariableOneToOneMapping clone = (VariableOneToOneMapping) super.clone();
    Map setOfKeys = new HashMap(getSourceToTargetQueryKeyNames().size());
    Map sourceToTarget = new HashMap(getSourceToTargetQueryKeyNames().size());
    Vector foreignKeys =
        org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(
            getForeignKeyFields().size());

    if (getTypeField() != null) {
      clone.setTypeField((DatabaseField) this.getTypeField().clone());
    }

    for (Iterator enumtr = getSourceToTargetQueryKeyNames().keySet().iterator();
        enumtr.hasNext(); ) {
      // Clone the SourceKeyFields
      DatabaseField field = (DatabaseField) enumtr.next();
      DatabaseField clonedField = (DatabaseField) field.clone();
      setOfKeys.put(field, clonedField);
      // on the next line I'm cloning the query key names
      sourceToTarget.put(clonedField, getSourceToTargetQueryKeyNames().get(field));
    }

    for (Enumeration enumtr = getForeignKeyFields().elements(); enumtr.hasMoreElements(); ) {
      DatabaseField field = (DatabaseField) enumtr.nextElement();
      foreignKeys.addElement(setOfKeys.get(field));
    }
    clone.setSourceToTargetQueryKeyFields(sourceToTarget);
    clone.setForeignKeyFields(foreignKeys);
    clone.setTypeIndicatorTranslation(new HashMap(this.getTypeIndicatorTranslation()));
    return clone;
  }
  /** Return the constraint ordered classes. */
  public Vector getOrderedClasses() {
    Vector orderedClasses =
        org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(
            getOrderedDescriptors().size());
    for (Enumeration orderedDescriptorsEnum = getOrderedDescriptors().elements();
        orderedDescriptorsEnum.hasMoreElements(); ) {
      orderedClasses.addElement(
          ((ClassDescriptor) orderedDescriptorsEnum.nextElement()).getJavaClass());
    }

    return orderedClasses;
  }
  /**
   * PUBLIC: Return the foreign key field names associated with the mapping. These are only the
   * source fields that are writable.
   */
  public void setForeignKeyFieldNames(Vector fieldNames) {
    Vector fields =
        org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(
            fieldNames.size());
    for (Enumeration fieldNamesEnum = fieldNames.elements(); fieldNamesEnum.hasMoreElements(); ) {
      fields.addElement(new DatabaseField((String) fieldNamesEnum.nextElement()));
    }

    setForeignKeyFields(fields);
    if (!fields.isEmpty()) {
      setIsForeignKeyRelationship(true);
    }
  }
 public ObjectRelationalDataTypeDescriptor() {
   this.orderedFields =
       org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance();
 }