
138 Cal.App.3d 256 (1982)
187 Cal. Rptr. 845
MOBIL OIL CORPORATION, Plaintiff and Respondent,
v.
AUGUST P. ROSSI, JR., et al., Defendants and Appellants.
Docket No. 24670.
Court of Appeals of California, Fourth District, Division One.
December 17, 1982.
*259 COUNSEL
Shapiro, Laufer, Posell & Close, David Laufer and James H. Lehr for Defendants and Appellants.
Buchalter, Nemer, Fields, Chrystie & Younger, Howard P. Miller, Leonard D. Venger and David H. Bramson for Plaintiff and Respondent.
OPINION
WIENER, Acting P.J.
Effective January 1, 1976, the Legislature added sections 20999 and 20999.1 to the Business and Professions Code to insure *260 competition and nondiscriminatory practices in the petroleum industry.[1] (Stats. 1975, ch. 640, § 2, p. 1390; Sherwood and Packer, Review of Selected 1975 California Legislation (1976) 7 Pacific L.J. 237, 306.) Under section 20999.1, a petroleum distributor could no longer terminate a franchise with a gasoline dealer without "good cause." "Good cause" is defined as the failure by the gasoline dealer to comply with essential and reasonable requirements of the franchise agreement, a failure to act in good faith in carrying out the terms of the franchise, or for other "legitimate business reasons." (See fn. 1, ante.) A year later the Legislature amended Code of Civil Procedure section 1174, subdivision (a) to require a showing of good cause before a petroleum distributor could regain possession from a gasoline dealer through unlawful detainer proceedings.[2] The good cause standards of section 20999.1 were expressly incorporated into this section. (1a) The question here is whether section 20999.1 and Code of Civil Procedure section 1174, subdivision (a) may be constitutionally applied to a franchise entered into before the effective date of the statute.
*261 We conclude the resolution of this question, in the context of this appeal, required preliminary factual determinations by the trial court. Before ruling on whether the statute impermissibly impairs contractual rights under either the federal or state Constitutions (U.S. Const., art. I, § 10; Cal. Const., art. I, § 9), a trial court must consider the extent of reliance on the former law of the party claiming unconstitutionality, the legitimacy of such reliance and the actions taken because of the reliance. Only after the cumulative effect of these factors is balanced against the significance of the state interest secured by the law and the importance of retroactive application to effectuate such interest may the court rule on the constitutionality of the statute. In the case before us, the trial court rejected relevant evidence on the nature and extent of the reliance by plaintiff, Mobil Oil Corporation (Mobil), on the former law and treated the constitutional question as being one of the law only. We hold this evidentiary ruling deprived the trial court of pertinent information essential to its weighing process and therefore we reverse the judgment in favor of Mobil.

Factual and Procedural Background
Defendants August P. Rossi, Jr., and Douglas J. Siemer (Rossi and Siemer) executed a lease for rental of a Mobil gasoline station for a term starting December 31, 1970, and ending December 31, 1973. The lease contained an "evergreen" clause which provided the lease would be automatically renewed at the expiration of the term unless a written 90-day notice of nonrenewal was given by either party.
Mobil properly terminated this lease and a successor lease was renegotiated and signed by the parties in October of 1973. The lease (the 1973 lease) ran from January 1, 1974 through December 31, 1976, and also contained an "evergreen" clause virtually identical to that of the previous lease. Mobil sent a letter to Siemer in June 1976 terminating the 1973 lease, but indicating Mobil's intention to submit a new lease for consideration. Efforts to negotiate a new lease were unsuccessful. Starting on the last day of the three-year term, December 31, 1976, Mobil refused to accept any rental payments although Rossi and Siemer remained in possession of the premises.
In September 1977, Mobil served a three-day notice to quit or pay rent. Mobil filed its complaint for unlawful detainer and damages in April 1978. Defendants successfully demurred and Mobil was required to amend its complaint to plead "good cause" under section 20999.1. Defendants' answer included the affirmative defense that Mobil was estopped from recovering possession because of Mobil's noncompliance with the disclosure statement required under the Franchise Investment Law. (Corp. Code, § 31000 et seq.) The trial court later struck this defense on the ground it was irrelevant to possession, the sole issue presented by the unlawful detainer action.
*262 An additional affirmative defense alleged Mobil's agents orally represented the lease would run for 12 years with no rent increase. At a pretrial hearing, the court held the 1973 lease was an integrated document and therefore evidence of oral representations was inadmissible under the parol evidence rule.
Before trial, the court ruled the good cause requirements of section 20999.1 and Code of Civil Procedure section 1174, subdivision (a) did not apply to the 1973 lease. Defendants' motion to reinstate the affirmative defense based upon the Franchise Investment Law was also denied.
At the conclusion of trial, the court directed a verdict in favor of Mobil on the issue of possession and the jury awarded Mobil $76,565 damages, representing the reasonable rental value of the premises for the period in controversy. Rossi and Siemer appeal the judgment entered on the jury verdict.

Discussion
Before addressing the constitutional issue before us, we must, as a preliminary matter, determine whether the Legislature intended section 20999.1 and Code of Civil Procedure section 1174, subdivision (a) to be applied retroactively.
(2) The Legislature declared the intent of newly enacted section 20999.1 was to insure the fair and efficient functioning of a free market economy, to market gasoline and other petroleum products in the manner most beneficial to the consumer and to prevent the disruption of vital energy sources. (Stats. 1975, ch. 640, § 2, p. 1390.) In order to expeditiously accomplish these goals without awaiting the expiration of preenactment franchises, the Legislature stated the statute was to apply to "existing" franchises "notwithstanding the terms of any franchise." The deliberate use of the word "existing" and the phrase "notwithstanding the terms of any franchise" reflect the legislative intent the enactment have retroactive application. (Donlan v. Weaver (1981) 118 Cal. App.3d 675, 679 [173 Cal. Rptr. 566].)
(3) Although this present tense language is lacking in Code of Civil Procedure section 1174, subdivision (a), we conclude it also was intended to be retroactively applied. Code of Civil Procedure section 1174 was amended January 1, 1977, in response to the "gap" left by section 20999.1. (Mobil Oil Corp. v. Handley (1978) 76 Cal. App.3d 956, 964-965 [143 Cal. Rptr. 321].) Under the latter section, a petroleum distributor was able to avoid the good cause requirement for nonrenewal by allowing the gas station lease to lapse and then removing the dealer through unlawful detainer proceedings. (Ibid.) To hold the good cause requirement under Code of Civil Procedure section 1174, subdivision (a) was prospective would not only ignore the inextricable relationship *263 between the two sections, but frustrate the legislative purpose so carefully articulated in section 20999.1.
(1b) The more difficult question is whether retroactive application of the statutes to the 1973 lease and franchise violates the contract clause of the state and federal Constitutions.
It is quite apparent that facially the respective statutes impair the obligations entered into under the lease and franchise. Under the terms of the negotiated agreements, Mobil had the right to terminate the relationship with Rossi and Siemer at the expiration of the three-year term for whatever lawful business reason it deemed prudent. The lacuna of "good cause" in either contract can hardly be viewed as representing an oversight by Mobil. Rather, the omission represented a material part of the bargain, assuring Mobil of flexibility in the future depending upon a variety of factors which could arise by that time. "But the fact that the state has impaired the obligations of these agreements by [enacting section 20999.1 and Code of Civil Procedure section 1174, subdivision (a)] is the beginning rather than the end of our analysis, for it has long been settled that although the constitutional provision, literally read, proscribes `any' impairment of contract it is `not an absolute one and is not to be read with literal exactness like a mathematical formula.' (Home Building & Loan Ass'n v. Blaisdell (1934) 290 U.S. 398, 428 [78 L.Ed.2d 413, 423, 54 S.Ct. 231, 88 A.L.R. 1481].) ... Our inquiry, then, concerns not whether the state may in some cases impair the obligation of contracts, but the circumstances under which such impairment is permissible." (Sonoma County Organization of Public Employees v. County of Sonoma (1979) 23 Cal.3d 296, 305 [152 Cal. Rptr. 903, 591 P.2d 1].)
(4) The analytical route which must be followed to properly determine whether there has been an unconstitutional impairment of contract requires identifying and weighing several factors. Ultimately, after examination of these factors, the court must balance the severity of the impairment resulting from retroactive application of the statute against the state interest served by the statute. The key inquiry is whether the importance of the state interest justifies the impairment. (Allied Structural Steel Co. v. Spannaus (1978) 438 U.S. 234, 244-251 [57 L.Ed.2d 727, 736-740, 98 S.Ct. 2716]; In re Marriage of Bouquet (1976) 16 Cal.3d 583, 592 [128 Cal. Rptr. 427, 546 P.2d 1371]; Donlan v. Weaver, supra, 118 Cal. App.3d at p. 682.)
(5) The specific factors which may be important in gauging the severity of impairment include the nature and significance of the right impaired, and whether such right is substantive or procedural (Flournoy v. State of California (1964) 230 Cal. App.2d 520, 533 [41 Cal. Rptr. 190]); whether the parties have relied on the preexisting contract right and the extent to which the statute *264 violates the reasonable expectations of the parties (Allied Structural Steel Co. v. Spannaus, supra, 438 U.S. at p. 246 [57 L.Ed.2d at p. 737]; In re Marriage of Bouquet, supra, 16 Cal.3d at p. 592); whether the law is temporary or indefinite in duration (Home Bldg. & L. Ass'n v. Blaisdell (1934) 290 U.S. 398, 447 [78 L.Ed. 413, 433, 54 S.Ct. 231, 88 A.L.R. 1481]; Sonoma County Organization of Public Employees v. County of Sonoma, supra, 23 Cal.3d at p. 306); and whether the legislation is in a previously regulated area (Comment, The Contract Clause: A Constitutional Basis For Invalidating State Legislation (1979) 12 Loyola L.A.L.Rev. 927).
(6) In evaluating the importance of the state interest and whether such interest justifies the impairment a court must consider where pertinent: whether the legislation was enacted to remedy an emergency situation (Home Bldg. & L. Ass'n v. Blaisdell, supra, 290 U.S. at p. 444 [78 L.Ed. at p. 432]; Sonoma County Organization of Public Employees v. County of Sonoma, supra, 23 Cal.3d at pp. 309-313); whether the law is "appropriately tailored and limited to the situation necessitating its enactment" (Donlan v. Weaver, supra, 118 Cal. App.3d at p. 682; Home Bldg. & L. Ass'n v. Blaisdell, supra, 290 U.S. at p. 445 [78 L.Ed. at p. 432]); the nature of the interest served by the legislation and whether the law was enacted to protect a broad societal interest rather than a narrow class (Allied Structural Steel Co. v. Spannaus, supra, 438 U.S. at pp. 248-249 [57 L.Ed.2d at pp. 738-739]).
Frequently, many, if not all, of these factors may be considered in the abstract without the need for evidence on contested matters of fact. In the context of the case before us, however, a factual inquiry was necessary.
(1c) At trial, Rossi and Siemer attempted to show retroactive application of section 20999.1 and Code of Civil Procedure section 1174, subdivision (a) to the contracts here would have little, if any, impact on Mobil because Mobil itself subscribed to a "good cause" policy for termination or renewal policy. According to the documents which defendants offered into evidence, but which the trial court rejected as irrelevant, Mobil's established guidelines for termination or nonrenewal of a lease or franchise were tied to objective criteria such as sales or appearance of the gasoline station, all of which were consistent with the "good cause" or "legitimate business reasons" required by the statute. Thus, the court was deprived of the benefit of relevant information on the extent to which Mobil relied upon the contracts and the degree of impairment on those contracts caused by the legislation. In this particular case, this data was absolutely essential for the balancing process which we have previously described. We conclude the trial court's failure to consider such evidence resulted in prejudicial error.
*265 The trial court's evidentiary ruling was understandably based upon its interpretation of the sparse case law dealing with the applicability of section 20999.1. (See, Mobil Oil Corp. v. Handley, supra, 76 Cal. App.3d 956; Union Oil Co. v. Moesch (1979) 88 Cal. App.3d 72 [151 Cal. Rptr. 517]; Witt v. Union Oil Co. (1979) 99 Cal. App.3d 435 [160 Cal. Rptr. 285].) The essential facts of each of these cases, however, are materially different from those involved here.
Mobil Oil Corp. v. Handley, supra, 76 Cal. App.3d at page 965, held section 20999.1 was inapplicable to a lease fully performed and terminated before its effective date. The court reasoned application of the good cause requirement to previously negotiated petroleum dealerships would result in "[a] formidable impairment of contract," and further stated the Handley lease did not fall under the terms of section 20999.1 because it was no longer "existing" on the effective date of the statute. (Id., at pp. 964-965.) In contrast, the defendants' 1973 lease came up for renewal after the effective date of section 20999.1, and thus we are confronted with an "existing" lease. Handley is not binding.
In Union Oil Co. v. Moesch, supra, 88 Cal. App.3d 72 the lease was entered into before the statute's effective date and expired after section 20999.1 became effective. The lease also provided that after the original term expired, a new holdover tenancy could be created with Union Oil's approval. A holdover tenancy was created per the lease terms and the court held good cause was required to terminate the tenancy. (Id., at p. 78.) The court also gave its opinion that if the dealer had attempted to apply section 20999.1 to the original lease (which, as in the present case, expired after the statute's effective date), such application would be unconstitutional. (Id., at p. 77.)
The final case considered, Witt v. Union Oil Co., supra, 99 Cal. App.3d at page 439, held good cause was not applicable to a lease which was entered into before the statute's effective date and automatically expired thereafter, since the lease contained no right of renewal. Although not faced with the issue, the court stated application of the good cause requirement to a lease also expiring after the effective date but with a right of renewal, would be an unconstitutional impairment of contract.
Although Moesch and Witt contain statements to the effect good cause cannot be applied to a lease entered into before the statute's effective date which comes up for renewal thereafter, these statements constitute dictum. In neither case was the court faced with the retroactivity issue in the factual framework presented by the case before us. We therefore conclude it was incumbent on the trial court to determine whether retroactive application of these statutes was constitutional in the circumstances of this case.
*266 For guidance to the trial court upon retrial there are two additional issues which require further comment.
(7a) First, Rossi and Siemer claim the court erred in striking the affirmative defense of illegality based upon the violation of the Franchise Investment Law (Corp. Code, § 31000 et seq.).
(8) A defendant in an unlawful detainer action is precluded from offering an affirmative defense if it is extrinsic to the issue of possession. (Green v. Superior Court (1974) 10 Cal.3d 616, 632-633 [111 Cal. Rptr. 704, 517 P.2d 1168].) (7b) In Mobil Oil Corp. v. Handley, supra, 76 Cal. App.3d at pages 963-964, the court determined "... violations of the Franchise Investment Law do not have the effect of continuing the franchise and hence are not relevant to the issue of possession. Appellant may be entitled to damages from Mobil, but he is not entitled to continue in possession of the station premises under any provision of the Franchise Investment Law. Accordingly, the trial court was correct in refusing to hear evidence on that issue." (Italics added.) We believe Handley is dispositive of defendants' contention on this issue.
(9a) Rossi and Siemer also challenge the court's ruling the 1973 lease was integrated and the court's consequent exclusion of parol evidence of alleged representations by Mobil the lease would run for 12 years with no rent increase. They claim the court's ruling is unsupported by substantial evidence. (Mobil Oil Corp. v. Handley, supra, 76 Cal. App.3d at p. 962.)
(10) In ruling on the matter of parol evidence and the preliminary issue of integration, a court must consider such factors as the language and completeness of the written agreement and whether it contains an integration clause, the terms of the alleged oral agreement and whether they contradict those in the writing, whether the oral agreement might naturally be made as a separate agreement, and whether the jury might be misled by the introduction of the parol testimony. (Brawthen v. H & R Block, Inc. (1975) 52 Cal. App.3d 139, 146 [124 Cal. Rptr. 845].) A court also considers the circumstances surrounding the transaction and its subject matter, nature and object. (Id., at pp. 146-147.)
(9b) Applying these principles here, we examine the evidence in support of the trial court's ruling. First, the lease contained an integration clause. More importantly, the terms of the alleged oral agreement directly contradicted the terms of the written lease. The written lease was for an initial three-year term whereas under the alleged oral agreement the term was twelve years. The asserted oral representation of no rent increase was also directly contrary to the express terms of the lease. We note these are terms which would naturally be included in the lease itself and not a collateral oral contract. In addition, the trial *267 judge rejected testimony offered by Rossi and Siemer that they had not read the written lease and had relied on the oral representations instead. The judge felt this testimony "stretch[ed] credulity" since both men were well-educated businessmen. We believe this evidence is sufficient to uphold the trial court's ruling the lease was an integrated document.

Disposition
Judgment reversed.
Work, J., and Zumwalt, J.,[*] concurred.
NOTES
[1]  All statutory references are to the Business and Professions Code unless otherwise specified. Section 20999.1 provides:

"Notwithstanding the terms of any franchise, no franchisor shall terminate, cancel[, or fail to] or refuse to renew any existing franchise without good cause.
"As used in this section good cause is limited to the following:
"(a) The gasoline dealer or petroleum distributor failed to comply with essential and reasonable requirements of the franchise agreement;
"(b) The gasoline dealer or petroleum distributor failed to act in good faith in carrying out the terms of the franchise; or
"(c) The franchisor is withdrawing from the marketing location at which the franchise of a gasoline dealer is located, provided that the franchisor pays the gasoline dealer the current wholesale market value for all qualifying equipment and supplies purchased by the gasoline dealer from the franchisor or affiliate of the franchisor. This subdivision shall only apply to those gasoline dealer franchises which are entered into or renewed on or after January 1, 1979. As used in this subdivision, `qualifying equipment and supplies' means all equipment and supplies purchased by the gasoline dealer from the franchisor or an affiliate of the franchisor which is free and clear of all liens, security interests and other encumbrances, valued on a first-in, first-out basis, evidenced by receipted invoices, and is (i) in first-class and resalable condition, (ii) in the original packages or containers and (iii) bears the original labels and trademarks, and (iv) the goods display no evidence of deterioration. This subdivision shall not be construed to create any priority over any other debt between the parties to the franchise arising from the same franchise agreement.
"(d) For other legitimate business reasons (except that a termination, or cancellation of a franchise for the purpose of enabling the petroleum distributor or manufacturer to assume operation of the distributor's or gasoline dealer's business shall not be considered to be a legitimate business reason unless the gasoline dealer or distributor is paid reasonable compensation for the value of his franchise, including a reasonable amount for good will)." (Bracketed portion of statute reflects subsequent amendment.)
[2]  Code of Civil Procedure section 1174, subdivision (a) provides in part: "Except as provided in Section 1166a, in any action for unlawful detainer brought by a petroleum distributor against a gasoline dealer, possession shall not be restored to the petroleum distributor unless the court in an unlawful detainer action determines that the petroleum distributor had good cause under Section 20999.1 of the Business and Professions Code to terminate, cancel, or refuse to renew the franchise of the gasoline dealer." (Italics supplied.)
[*]   Assigned by the Chairperson of the Judicial Council.
