We revisit the compositeness theorem proposed by Weinberg in an effective field theory (EFT) and explore criteria which are sensitive to the structure of S-wave threshold states. On a general basis, we show that the wave function renormalization constant Z, which is the probability of finding an elementary component in the wave function of a threshold state, can be explicitly introduced in the description of the threshold state. As an application of this EFT method, we describe the near-threshold line shape of the D*(0)(D) over bar (0) invariant mass spectrum in B -> D*(0)(D) over bar K-0 and determine a nonvanishing value of Z. It suggests that the X(3872) as a candidate of the D*(0)(D) over bar (0) molecule may still contain a small c (c) over bar core. This elementary component, on the one hand, explains its production in the B meson decay via a short-distance mechanism, and on the other hand, is correlated with the D*(0)(D) over bar (0) threshold enhancement observed in the D*(0)(D) over bar (0) invariant mass distributions. Meanwhile, we also show that if Z is non-zero, the near-threshold enhancement of the D*(0)(D) over bar (0) mass spectrum in the B decay will be driven by the short-distance production mechanism.