@Override // made public for testing public boolean isLegacyConstruction() { return super.isLegacyConstruction(); }
/** * @deprecated since 0.5; instead use no-arg constructor with EntityManager().createEntity(spec) */ @Deprecated public AbstractEntity(@SuppressWarnings("rawtypes") Map flags, Entity parent) { super(checkConstructorFlags(flags, parent)); // TODO Don't let `this` reference escape during construction entityType = new EntityDynamicType(this); if (isLegacyConstruction()) { AbstractEntity checkWeGetThis = configure(flags); assert this.equals(checkWeGetThis) : this+" configure method does not return itself; returns "+checkWeGetThis+" instead of "+this; boolean deferConstructionChecks = (flags.containsKey("deferConstructionChecks") && TypeCoercions.coerce(flags.get("deferConstructionChecks"), Boolean.class)); if (!deferConstructionChecks) { FlagUtils.checkRequiredFields(this); } } }
displayName.set((String) flags.remove("name")); displayNameAutoGenerated = false; } else if (isLegacyConstruction()) { displayName.set(getClass().getSimpleName()+":"+Strings.maxlen(getId(), 4)); displayNameAutoGenerated = true;
/** * Invoked by {@link EntityManagementSupport} when this entity is becoming managed (i.e. it has a working * management context, but before the entity is visible to other entities), including during a rebind. */ public void onManagementStarting() { if (isLegacyConstruction()) { entityType.setName(getEntityTypeName()); if (displayNameAutoGenerated) displayName.set(getEntityType().getSimpleName()+":"+Strings.maxlen(getId(), 4)); } }