Java源码示例:com.sun.tools.internal.xjc.model.CTypeRef
示例1
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
assert !target.isCollection();
CAdapter a = target.getProperty().getAdapter();
if(a!=null && ep!=null) ep.setAdapter(a);
return new CTypeRef(target.getContentType(),decl);
}
示例2
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
assert !target.isCollection();
CAdapter a = target.getProperty().getAdapter();
if(a!=null && ep!=null) ep.setAdapter(a);
return new CTypeRef(target.getContentType(),decl);
}
示例3
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
assert !target.isCollection();
CAdapter a = target.getProperty().getAdapter();
if(a!=null && ep!=null) ep.setAdapter(a);
return new CTypeRef(target.getContentType(),decl);
}
示例4
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
assert !target.isCollection();
CAdapter a = target.getProperty().getAdapter();
if(a!=null && ep!=null) ep.setAdapter(a);
return new CTypeRef(target.getContentType(),decl);
}
示例5
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
assert !target.isCollection();
CAdapter a = target.getProperty().getAdapter();
if(a!=null && ep!=null) ep.setAdapter(a);
return new CTypeRef(target.getContentType(),decl);
}
示例6
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
assert !target.isCollection();
CAdapter a = target.getProperty().getAdapter();
if(a!=null && ep!=null) ep.setAdapter(a);
return new CTypeRef(target.getContentType(),decl);
}
示例7
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
assert !target.isCollection();
CAdapter a = target.getProperty().getAdapter();
if(a!=null && ep!=null) ep.setAdapter(a);
return new CTypeRef(target.getContentType(),decl);
}
示例8
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
assert !target.isCollection();
CAdapter a = target.getProperty().getAdapter();
if(a!=null && ep!=null) ep.setAdapter(a);
return new CTypeRef(target.getContentType(),decl);
}
示例9
/**
* Generate the simplest XmlElement annotation possible taking all semantic optimizations
* into account. This method is essentially equivalent to:
*
* xew.name(ctype.getTagName().getLocalPart())
* .namespace(ctype.getTagName().getNamespaceURI())
* .type(jtype)
* .defaultValue(ctype.getDefaultValue());
*
* @param field
* @param ctype
* @param jtype
* @param checkWrapper true if the method might need to generate XmlElements
*/
private void writeXmlElementAnnotation( JAnnotatable field, CTypeRef ctype, JType jtype,
boolean checkWrapper ) {
// lazily create - we don't know if we need to generate anything yet
XmlElementWriter xew = null;
// these values are used to determine how to optimize the generated annotation
XmlNsForm formDefault = parent()._package().getElementFormDefault();
String propName = prop.getName(false);
String enclosingTypeNS;
if(parent().target.getTypeName()==null)
enclosingTypeNS = parent()._package().getMostUsedNamespaceURI();
else
enclosingTypeNS = parent().target.getTypeName().getNamespaceURI();
// generate the name property?
String generatedName = ctype.getTagName().getLocalPart();
if(!generatedName.equals(propName)) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.name(generatedName);
}
// generate the namespace property?
String generatedNS = ctype.getTagName().getNamespaceURI();
if (((formDefault == XmlNsForm.QUALIFIED) && !generatedNS.equals(enclosingTypeNS)) ||
((formDefault == XmlNsForm.UNQUALIFIED) && !generatedNS.equals(""))) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.namespace(generatedNS);
}
// generate the required() property?
CElementPropertyInfo ep = (CElementPropertyInfo) prop;
if(ep.isRequired() && exposedType.isReference()) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.required(true);
}
// generate the type property?
// I'm not too sure if this is the right place to handle this, but
// if the schema definition is requiring this element, we should point to a primitive type,
// not wrapper type (to correctly carry forward the required semantics.)
// if it's a collection, we can't use a primitive, however.
if(ep.isRequired() && !prop.isCollection())
jtype = jtype.unboxify();
// when generating code for 1.4, the runtime can't infer that ArrayList<Foo> derives
// from Collection<Foo> (because List isn't parameterized), so always expclitly
// generate @XmlElement(type=...)
if( !jtype.equals(exposedType) || (getOptions().runtime14 && prop.isCollection())) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.type(jtype);
}
// generate defaultValue property?
final String defaultValue = ctype.getDefaultValue();
if (defaultValue!=null) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.defaultValue(defaultValue);
}
// generate the nillable property?
if (ctype.isNillable()) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.nillable(true);
}
}
示例10
/**
* return the Java type for the given type reference in the model.
*/
private JType resolve(CTypeRef typeRef,Aspect a) {
return outline.parent().resolve(typeRef,a);
}
示例11
public final JType resolve(CTypeRef ref, Aspect a) {
return ref.getTarget().getType().toType(this, a);
}
示例12
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
// we don't allow a mapping to typeRef if the wildcard is present
throw new IllegalStateException();
}
示例13
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
return new CTypeRef(target,decl);
}
示例14
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
if(ep!=null && target.getAdapterUse()!=null)
ep.setAdapter(target.getAdapterUse());
return new CTypeRef(target.getInfo(),decl);
}
示例15
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
return new CTypeRef(ci,ci.getElementName(),ci.getTypeName(),false,null);
}
示例16
/**
* Generate the simplest XmlElement annotation possible taking all semantic optimizations
* into account. This method is essentially equivalent to:
*
* xew.name(ctype.getTagName().getLocalPart())
* .namespace(ctype.getTagName().getNamespaceURI())
* .type(jtype)
* .defaultValue(ctype.getDefaultValue());
*
* @param field
* @param ctype
* @param jtype
* @param checkWrapper true if the method might need to generate XmlElements
*/
private void writeXmlElementAnnotation( JAnnotatable field, CTypeRef ctype, JType jtype,
boolean checkWrapper ) {
// lazily create - we don't know if we need to generate anything yet
XmlElementWriter xew = null;
// these values are used to determine how to optimize the generated annotation
XmlNsForm formDefault = parent()._package().getElementFormDefault();
String propName = prop.getName(false);
String enclosingTypeNS;
if(parent().target.getTypeName()==null)
enclosingTypeNS = parent()._package().getMostUsedNamespaceURI();
else
enclosingTypeNS = parent().target.getTypeName().getNamespaceURI();
// generate the name property?
String generatedName = ctype.getTagName().getLocalPart();
if(!generatedName.equals(propName)) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.name(generatedName);
}
// generate the namespace property?
String generatedNS = ctype.getTagName().getNamespaceURI();
if (((formDefault == XmlNsForm.QUALIFIED) && !generatedNS.equals(enclosingTypeNS)) ||
((formDefault == XmlNsForm.UNQUALIFIED) && !generatedNS.equals(""))) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.namespace(generatedNS);
}
// generate the required() property?
CElementPropertyInfo ep = (CElementPropertyInfo) prop;
if(ep.isRequired() && exposedType.isReference()) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.required(true);
}
// generate the type property?
// I'm not too sure if this is the right place to handle this, but
// if the schema definition is requiring this element, we should point to a primitive type,
// not wrapper type (to correctly carry forward the required semantics.)
// if it's a collection, we can't use a primitive, however.
if(ep.isRequired() && !prop.isCollection())
jtype = jtype.unboxify();
// when generating code for 1.4, the runtime can't infer that ArrayList<Foo> derives
// from Collection<Foo> (because List isn't parameterized), so always expclitly
// generate @XmlElement(type=...)
if( !jtype.equals(exposedType) || (getOptions().runtime14 && prop.isCollection())) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.type(jtype);
}
// generate defaultValue property?
final String defaultValue = ctype.getDefaultValue();
if (defaultValue!=null) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.defaultValue(defaultValue);
}
// generate the nillable property?
if (ctype.isNillable()) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.nillable(true);
}
}
示例17
/**
* return the Java type for the given type reference in the model.
*/
private JType resolve(CTypeRef typeRef,Aspect a) {
return outline.parent().resolve(typeRef,a);
}
示例18
public final JType resolve(CTypeRef ref, Aspect a) {
return ref.getTarget().getType().toType(this, a);
}
示例19
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
// we don't allow a mapping to typeRef if the wildcard is present
throw new IllegalStateException();
}
示例20
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
return new CTypeRef(target,decl);
}
示例21
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
if(ep!=null && target.getAdapterUse()!=null)
ep.setAdapter(target.getAdapterUse());
return new CTypeRef(target.getInfo(),decl);
}
示例22
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
return new CTypeRef(ci,ci.getElementName(),ci.getTypeName(),false,null);
}
示例23
/**
* Generate the simplest XmlElement annotation possible taking all semantic optimizations
* into account. This method is essentially equivalent to:
*
* xew.name(ctype.getTagName().getLocalPart())
* .namespace(ctype.getTagName().getNamespaceURI())
* .type(jtype)
* .defaultValue(ctype.getDefaultValue());
*
* @param field
* @param ctype
* @param jtype
* @param checkWrapper true if the method might need to generate XmlElements
*/
private void writeXmlElementAnnotation( JAnnotatable field, CTypeRef ctype, JType jtype,
boolean checkWrapper ) {
// lazily create - we don't know if we need to generate anything yet
XmlElementWriter xew = null;
// these values are used to determine how to optimize the generated annotation
XmlNsForm formDefault = parent()._package().getElementFormDefault();
String propName = prop.getName(false);
String enclosingTypeNS;
if(parent().target.getTypeName()==null)
enclosingTypeNS = parent()._package().getMostUsedNamespaceURI();
else
enclosingTypeNS = parent().target.getTypeName().getNamespaceURI();
// generate the name property?
String generatedName = ctype.getTagName().getLocalPart();
if(!generatedName.equals(propName)) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.name(generatedName);
}
// generate the namespace property?
String generatedNS = ctype.getTagName().getNamespaceURI();
if (((formDefault == XmlNsForm.QUALIFIED) && !generatedNS.equals(enclosingTypeNS)) ||
((formDefault == XmlNsForm.UNQUALIFIED) && !generatedNS.equals(""))) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.namespace(generatedNS);
}
// generate the required() property?
CElementPropertyInfo ep = (CElementPropertyInfo) prop;
if(ep.isRequired() && exposedType.isReference()) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.required(true);
}
// generate the type property?
// I'm not too sure if this is the right place to handle this, but
// if the schema definition is requiring this element, we should point to a primitive type,
// not wrapper type (to correctly carry forward the required semantics.)
// if it's a collection, we can't use a primitive, however.
if(ep.isRequired() && !prop.isCollection())
jtype = jtype.unboxify();
// when generating code for 1.4, the runtime can't infer that ArrayList<Foo> derives
// from Collection<Foo> (because List isn't parameterized), so always expclitly
// generate @XmlElement(type=...)
if( !jtype.equals(exposedType) || (getOptions().runtime14 && prop.isCollection())) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.type(jtype);
}
// generate defaultValue property?
final String defaultValue = ctype.getDefaultValue();
if (defaultValue!=null) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.defaultValue(defaultValue);
}
// generate the nillable property?
if (ctype.isNillable()) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.nillable(true);
}
}
示例24
/**
* return the Java type for the given type reference in the model.
*/
private JType resolve(CTypeRef typeRef,Aspect a) {
return outline.parent().resolve(typeRef,a);
}
示例25
public final JType resolve(CTypeRef ref, Aspect a) {
return ref.getTarget().getType().toType(this, a);
}
示例26
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
// we don't allow a mapping to typeRef if the wildcard is present
throw new IllegalStateException();
}
示例27
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
return new CTypeRef(target,decl);
}
示例28
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
if(ep!=null && target.getAdapterUse()!=null)
ep.setAdapter(target.getAdapterUse());
return new CTypeRef(target.getInfo(),decl);
}
示例29
protected CTypeRef toTypeRef(CElementPropertyInfo ep) {
return new CTypeRef(ci,ci.getElementName(),ci.getTypeName(),false,null);
}
示例30
/**
* Generate the simplest XmlElement annotation possible taking all semantic optimizations
* into account. This method is essentially equivalent to:
*
* xew.name(ctype.getTagName().getLocalPart())
* .namespace(ctype.getTagName().getNamespaceURI())
* .type(jtype)
* .defaultValue(ctype.getDefaultValue());
*
* @param field
* @param ctype
* @param jtype
* @param checkWrapper true if the method might need to generate XmlElements
*/
private void writeXmlElementAnnotation( JAnnotatable field, CTypeRef ctype, JType jtype,
boolean checkWrapper ) {
// lazily create - we don't know if we need to generate anything yet
XmlElementWriter xew = null;
// these values are used to determine how to optimize the generated annotation
XmlNsForm formDefault = parent()._package().getElementFormDefault();
String propName = prop.getName(false);
String enclosingTypeNS;
if(parent().target.getTypeName()==null)
enclosingTypeNS = parent()._package().getMostUsedNamespaceURI();
else
enclosingTypeNS = parent().target.getTypeName().getNamespaceURI();
// generate the name property?
String generatedName = ctype.getTagName().getLocalPart();
if(!generatedName.equals(propName)) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.name(generatedName);
}
// generate the namespace property?
String generatedNS = ctype.getTagName().getNamespaceURI();
if (((formDefault == XmlNsForm.QUALIFIED) && !generatedNS.equals(enclosingTypeNS)) ||
((formDefault == XmlNsForm.UNQUALIFIED) && !generatedNS.equals(""))) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.namespace(generatedNS);
}
// generate the required() property?
CElementPropertyInfo ep = (CElementPropertyInfo) prop;
if(ep.isRequired() && exposedType.isReference()) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.required(true);
}
// generate the type property?
// I'm not too sure if this is the right place to handle this, but
// if the schema definition is requiring this element, we should point to a primitive type,
// not wrapper type (to correctly carry forward the required semantics.)
// if it's a collection, we can't use a primitive, however.
if(ep.isRequired() && !prop.isCollection())
jtype = jtype.unboxify();
// when generating code for 1.4, the runtime can't infer that ArrayList<Foo> derives
// from Collection<Foo> (because List isn't parameterized), so always expclitly
// generate @XmlElement(type=...)
if( !jtype.equals(exposedType) || (getOptions().runtime14 && prop.isCollection())) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.type(jtype);
}
// generate defaultValue property?
final String defaultValue = ctype.getDefaultValue();
if (defaultValue!=null) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.defaultValue(defaultValue);
}
// generate the nillable property?
if (ctype.isNillable()) {
if(xew == null) xew = getXew(checkWrapper, field);
xew.nillable(true);
}
}