public boolean equals(Object object) {
   if (!super.equals(object)) {
     return false;
   }
   TreatAsExpression expression = (TreatAsExpression) object;
   return getCastClass().equals(expression.getCastClass());
 }
  public Expression twistedForBaseAndContext(
      Expression newBase, Expression context, Expression oldBase) {
    if (oldBase == null || this.typeExpressionBase == oldBase) {
      Expression twistedBase =
          this.typeExpressionBase.twistedForBaseAndContext(newBase, context, oldBase);
      TreatAsExpression result = (TreatAsExpression) twistedBase.treat(this.castClass);
      if (shouldUseOuterJoin) {
        result.doUseOuterJoin();
      }
      if (shouldQueryToManyRelationship) {
        result.doQueryToManyRelationship();
      }
      return result;
    }

    return this;
  }