I completed a "refactoring" of JCas into interface + impl. It was done
with the refactoring tools of Eclipse - so it's "mechanical" - no real
"thought" :-)
As described below, I had to rename the old JCas to JCasImpl; I moved
the new interface to
org.apache.uima.jcas.JCas.
I still have to fix JCasGen to generate the right kinds of cover
classes. The refactoring went thru all the existing generated classes
and "fixed them up".
Some further issues to consider / think about:
1) having the generated JCas classes use a different class, JCasUtils
(?) for their static methods.
2) factoring out the common interface definitions for CAS interface and
JCas interface - a lot of them should be the same. It would be nice to
have this clearly partitioned, logically :-)
-Marshall
Marshall Schor wrote:
I'm starting to look at converting JCas to an interface, with an
impl. First issue found: this class contains static methods used by
JCasGen-erated code, for factored-out,
common methods to report errors, etc.
(e.g. when getting a feature, there's code like:
if (featOkTst && casFeat_xxxx == null)
JCas.throwFeatMissing("xxxx, "cas-type-name-for-xxxx");
These calls are in pre-existing JCas cover classes. I guess we're
planning to have new JCas cover classes generated
(unless we put in a layer to make the old ones work - they would be
tying into classes named "com.ibm.etc.").
So I can change JCasGen to generate a ref to JCasImpl.etc. instead of
JCas.etc.
if( featOkTst && casFeat_xxxx == null)
JCasImpl.throwFeatMissing("xxxx, "cas-type-name-for-xxxx");
Does this sound like the right idea?
-Marshall