/** Allocate the property to a list. */
  private void allocateToList(BeanProperty prop) {
    if (prop.isTransient()) {
      transients.add(prop);
      if (prop.isDraft()) {
        draft = prop;
      }
      return;
    }
    if (prop.isId()) {
      ids.add(prop);
      return;
    } else {
      nonTransients.add(prop);
    }

    if (prop.isMutableScalarType()) {
      mutable.add(prop);
    }

    if (desc.getInheritInfo() != null && prop.isLocal()) {
      local.add(prop);
    }

    if (prop instanceof BeanPropertyAssocMany<?>) {
      manys.add((BeanPropertyAssocMany<?>) prop);

    } else {
      nonManys.add(prop);
      if (prop instanceof BeanPropertyAssocOne<?>) {
        BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>) prop;
        if (prop.isEmbedded()) {
          embedded.add(assocOne);
        } else {
          ones.add(assocOne);
          if (!assocOne.isOneToOneExported()) {
            onesImported.add(assocOne);
          }
        }
      } else {
        // its a "base" property...
        if (prop.isVersion()) {
          if (versionProperty == null) {
            versionProperty = prop;
          } else {
            logger.warn(
                "Multiple @Version properties - property "
                    + prop.getFullBeanName()
                    + " not treated as a version property");
          }
        } else if (prop.isDraftDirty()) {
          draftDirty = prop;
        }
        if (prop instanceof BeanPropertyCompound) {
          baseCompound.add((BeanPropertyCompound) prop);
        } else {
          baseScalar.add(prop);
        }
      }
    }
  }
예제 #2
0
  /**
   * Create a Matching BeanProperty with some attributes overridden.
   *
   * <p>Primarily for supporting Embedded beans with overridden dbColumn mappings.
   */
  public BeanProperty(BeanProperty source, BeanPropertyOverride override) {

    this.descriptor = source.descriptor;
    this.name = InternString.intern(source.getName());
    this.propertyIndex = source.propertyIndex;
    this.dbColumn = InternString.intern(override.getDbColumn());
    // override with sqlFormula not currently supported
    this.sqlFormulaJoin = null;
    this.sqlFormulaSelect = null;
    this.formula = false;

    this.excludedFromHistory = source.excludedFromHistory;
    this.draft = source.draft;
    this.draftDirty = source.draftDirty;
    this.draftOnly = source.draftOnly;
    this.draftReset = source.draftReset;
    this.softDelete = source.softDelete;
    this.softDeleteDbSet = source.softDeleteDbSet;
    this.softDeleteDbPredicate = source.softDeleteDbPredicate;
    this.fetchEager = source.fetchEager;
    this.unidirectionalShadow = source.unidirectionalShadow;
    this.discriminator = source.discriminator;
    this.localEncrypted = source.isLocalEncrypted();
    this.isTransient = source.isTransient();
    this.secondaryTable = source.isSecondaryTable();
    this.secondaryTableJoin = source.secondaryTableJoin;
    this.secondaryTableJoinPrefix = source.secondaryTableJoinPrefix;

    this.dbComment = source.dbComment;
    this.dbBind = source.getDbBind();
    this.dbEncrypted = source.isDbEncrypted();
    this.dbEncryptedType = source.getDbEncryptedType();
    this.dbEncryptFunction = source.dbEncryptFunction;
    this.dbRead = source.isDbRead();
    this.dbInsertable = source.isDbInsertable();
    this.dbUpdatable = source.isDbUpdatable();
    this.nullable = source.isNullable();
    this.unique = source.isUnique();
    this.naturalKey = source.isNaturalKey();
    this.dbLength = source.getDbLength();
    this.dbScale = source.getDbScale();
    this.dbColumnDefn = InternString.intern(source.getDbColumnDefn());
    this.dbColumnDefault = source.dbColumnDefault;

    this.inherited = source.isInherited();
    this.owningType = source.owningType;
    this.local = owningType.equals(descriptor.getBeanType());

    this.version = source.isVersion();
    this.embedded = source.isEmbedded();
    this.id = source.isId();
    this.generatedProperty = source.getGeneratedProperty();
    this.getter = source.getter;
    this.setter = source.setter;
    this.dbType = source.getDbType(true);
    this.scalarType = source.scalarType;
    this.lob = isLobType(dbType);
    this.propertyType = source.getPropertyType();
    this.field = source.getField();
    this.docOptions = source.docOptions;

    this.elPlaceHolder = override.replace(source.elPlaceHolder, source.dbColumn);
    this.elPlaceHolderEncrypted = override.replace(source.elPlaceHolderEncrypted, source.dbColumn);

    this.jsonSerialize = source.jsonSerialize;
    this.jsonDeserialize = source.jsonDeserialize;
  }