コード例 #1
0
ファイル: Map.java プロジェクト: nbartels/datanucleus-core
  /**
   * Constructor, using the ObjectProvider of the "owner" and the field name.
   *
   * @param op The owner ObjectProvider
   * @param mmd Metadata for the member
   */
  public Map(ObjectProvider op, AbstractMemberMetaData mmd) {
    super(op, mmd);

    // Set up our "delegate"
    this.delegate = new java.util.HashMap();

    ExecutionContext ec = ownerOP.getExecutionContext();
    allowNulls = SCOUtils.allowNullsInContainer(allowNulls, mmd);
    useCache = SCOUtils.useContainerCache(ownerOP, mmd);

    if (!SCOUtils.mapHasSerialisedKeysAndValues(mmd)
        && mmd.getPersistenceModifier() == FieldPersistenceModifier.PERSISTENT) {
      ClassLoaderResolver clr = ec.getClassLoaderResolver();
      this.backingStore =
          (MapStore)
              ((BackedSCOStoreManager) ownerOP.getStoreManager())
                  .getBackingStoreForField(clr, mmd, java.util.Map.class);
    }

    if (NucleusLogger.PERSISTENCE.isDebugEnabled()) {
      NucleusLogger.PERSISTENCE.debug(
          SCOUtils.getContainerInfoMessage(
              ownerOP,
              ownerMmd.getName(),
              this,
              useCache,
              allowNulls,
              SCOUtils.useCachedLazyLoading(ownerOP, ownerMmd)));
    }
  }
コード例 #2
0
  /**
   * Constructor, using the ObjectProvider of the "owner" and the field name.
   *
   * @param op The owner ObjectProvider
   * @param mmd Metadata for the member
   */
  public ArrayList(ObjectProvider op, AbstractMemberMetaData mmd) {
    super(op, mmd);

    // Set up our delegate
    this.delegate = new java.util.ArrayList();

    ExecutionContext ec = op.getExecutionContext();
    allowNulls = SCOUtils.allowNullsInContainer(allowNulls, mmd);
    queued = ec.isDelayDatastoreOperationsEnabled();
    useCache = SCOUtils.useContainerCache(op, mmd);

    if (!SCOUtils.collectionHasSerialisedElements(mmd)
        && mmd.getPersistenceModifier() == FieldPersistenceModifier.PERSISTENT) {
      ClassLoaderResolver clr = ec.getClassLoaderResolver();
      this.backingStore =
          (ListStore)
              ((BackedSCOStoreManager) op.getStoreManager())
                  .getBackingStoreForField(clr, mmd, java.util.ArrayList.class);
    }

    if (NucleusLogger.PERSISTENCE.isDebugEnabled()) {
      NucleusLogger.PERSISTENCE.debug(
          SCOUtils.getContainerInfoMessage(
              op,
              ownerMmd.getName(),
              this,
              useCache,
              queued,
              allowNulls,
              SCOUtils.useCachedLazyLoading(op, ownerMmd)));
    }
  }