/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* DTD Element.
*
* <p>
* This class extends {@link Term} to participate in the content model tree.
*
* <p>
* This class is repsonsible for binding the element.
*
* @author Kohsuke Kawaguchi
*/
/**
* Name of the element.
*/
/**
* @see DTDEventListener#endContentModel(String, short)
*/
private short contentModelType;
/**
* True if this element is referenced from another element.
*/
boolean isReferenced;
/**
* If this element maps to a class, that class representation.
* Otherwise null.
*/
/**
* True if {@link #classInfo} field is computed.
*/
private boolean classInfoComputed;
/**
* List of attribute properties on this element
*/
/**
* Normalized blocks of the content model.
*/
/**
* True if this element needs to be a class.
*
* Currently, if an element is referenced from a construct like (A|B|C),
* we require those A,B, and C to be a class.
*/
private boolean mustBeClass;
/**
* The source location where this element is defined.
*/
}
r.add(o);
}
}
boolean isOptional() {
return false;
}
boolean isRepeated() {
return false;
}
/**
* Define its content model.
*/
this.contentModelType = contentModelType;
this.contentModel = contentModel;
for( Block b : normalizedBlocks ) {
}
}
}
}
/**
* When this element is an PCDATA-only content model,
* returns the conversion for it. Otherwise the behavior is undefined.
*/
if(e!=null) {
return conv.getTransducer();
}
return CBuiltinLeafInfo.STRING;
}
/**
* Return null if this class is not bound to a class.
*/
if(!classInfoComputed) {
classInfoComputed = true;
}
return classInfo;
}
if(e==null) {
|| !attributes.isEmpty()
|| mustBeClass)
return createDefaultClass();
throw new UnsupportedOperationException("mixed content model not supported");
} else {
// just #PCDATA
if(isReferenced)
return null;
else
// if no one else is referencing, assumed to be the root.
return createDefaultClass();
}
} else {
return e.clazz;
}
}
return new CClassInfo(owner.model,owner.getTargetPackage(),className,locator,null,tagName,null,null/*TODO*/);
}
void bind() {
for( CPropertyInfo p : attributes )
ci.addProperty(p);
switch(contentModelType) {
CReferencePropertyInfo rp = new CReferencePropertyInfo("Content",true,false,true,null,null/*TODO*/,locator, false, false, false);
return;
break; // handling follows
throw new UnsupportedOperationException("mixed content model unsupported yet");
// if this element is mapped to a class, just put one property
CValuePropertyInfo p = new CValuePropertyInfo("value", null,null/*TODO*/,locator,getConversion(),null);
ci.addProperty(p);
}
return;
// no content model
return;
}
// normalize
contentModel.normalize(n,false);
{// check collision among Blocks
boolean collision = false;
for( Block b : n )
collision = true;
break OUTER;
}
if(collision) {
// collapse all blocks into one
for( Block b : n )
n.clear();
}
}
for( Block b : n ) {
// collection
}
p = new CElementPropertyInfo(name.toString(), REPEATED_ELEMENT, ID.NONE, null, null,null/*TODO*/, locator, !b.isOptional );
}
} else {
// single property
else {
}
p = new CElementPropertyInfo(propName,
refType.isCollection()?REPEATED_VALUE:NOT_REPEATED, ID.NONE, null, null,null/*TODO*/, locator, !b.isOptional );
}
ci.addProperty(p);
}
}
}
}