本文整理匯總了Java中com.sun.tools.xjc.model.CTypeRef類的典型用法代碼示例。如果您正苦於以下問題:Java CTypeRef類的具體用法?Java CTypeRef怎麽用?Java CTypeRef使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CTypeRef類屬於com.sun.tools.xjc.model包,在下文中一共展示了CTypeRef類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: simplifyElementPropertyInfoAsElementPropertyInfo
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
private void simplifyElementPropertyInfoAsElementPropertyInfo(
final Model model, final CClassInfo classInfo,
CElementPropertyInfo property) {
if (property.getTypes().size() > 1) {
logger.debug(MessageFormat
.format("Element property [{0}] has several types and will be simplified.",
property.getName(false)));
int index = classInfo.getProperties().indexOf(property);
for (CTypeRef typeRef : property.getTypes()) {
final CElementPropertyInfo elementPropertyInfo = createElementPropertyInfo(
model, property, typeRef);
classInfo.getProperties().add(index++, elementPropertyInfo);
}
classInfo.getProperties().remove(property);
} else {
logger.warn(MessageFormat
.format("Element property [{0}] will not be simplified as it does not contain multiple types.",
property.getName(false)));
}
}
示例2: createElementPropertyInfo
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
private CElementPropertyInfo createElementPropertyInfo(final Model model,
CElementPropertyInfo property, CTypeRef typeRef) {
final String propertyName = createPropertyName(model, property, typeRef);
boolean required = false;
final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo(
propertyName,
property.isCollection() ? CollectionMode.REPEATED_ELEMENT
: CollectionMode.NOT_REPEATED, typeRef.getTarget()
.idUse(), typeRef.getTarget().getExpectedMimeType(),
property.getSchemaComponent(), property.getCustomizations(),
property.getLocator(), required);
final CAdapter adapter = property.getAdapter();
if (adapter != null) {
elementPropertyInfo.setAdapter(adapter);
}
elementPropertyInfo.getTypes().add(typeRef);
return elementPropertyInfo;
}
示例3: createElementPropertyInfo
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
public CPropertyInfo createElementPropertyInfo(String propertyName,
XSComponent source, TypeUse propertyType, QName propertyQName,
CollectionMode collectionMode, CCustomizations customizations) {
final CNonElement propertyTypeInfo = propertyType.getInfo();
final CElementPropertyInfo propertyInfo = new CElementPropertyInfo(
propertyName, collectionMode, propertyTypeInfo.idUse(),
propertyTypeInfo.getExpectedMimeType(), source, customizations,
null, true);
final CTypeRef typeRef = new CTypeRef(propertyTypeInfo, propertyQName,
propertyTypeInfo.getTypeName(), false, null);
propertyInfo.setAdapter(propertyType.getAdapterUse());
propertyInfo.getTypes().add(typeRef);
return propertyInfo;
}
示例4: getDefaultValueNamespaceContext
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
@Override
protected NamespaceContext getDefaultValueNamespaceContext(
TypeRef<NType, NClass> typeRef) {
if (typeRef instanceof CTypeRef) {
final CTypeRef cTypeRef = (CTypeRef) typeRef;
return new NamespaceContextAdapter(cTypeRef.defaultValue);
} else {
return null;
}
}
示例5: XJCCMElementTypeRefOrigin
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
public XJCCMElementTypeRefOrigin(CElementPropertyInfo source,
CTypeRef typeRef) {
super(source, typeRef);
final XSComponent schemaComponent = source.getSchemaComponent();
if (schemaComponent != null) {
final FindXSElementDeclVisitor visitor = new FindXSElementDeclVisitor(
typeRef.getTagName());
schemaComponent.visit(visitor);
this.component = visitor.getElementDecl();
} else {
this.component = null;
}
}
示例6: getElementAnnotation
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
private static ElementAnnotation getElementAnnotation(ClassOutline parent, CPropertyInfo prop, CTypeRef ctype) {
ElementAnnotation elementAnnotation = null;
String propName = prop.getName(false);
// generate the name property?
String generatedName = ctype.getTagName().getLocalPart();
if(!generatedName.equals(propName)) {
elementAnnotation = new ElementAnnotation();
elementAnnotation.setName(generatedName);
}
return elementAnnotation;
}
示例7: createElementTypeRefOrigin
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
@Override
protected MElementTypeRefOrigin createElementTypeRefOrigin(
CElementPropertyInfo ep, CTypeRef typeRef) {
return new XJCCMElementTypeRefOrigin(ep, typeRef);
}
示例8: createPropertyName
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
private String createPropertyName(final Model model,
CPropertyInfo propertyInfo, CTypeRef element) {
final String propertyName = model.getNameConverter().toPropertyName(
pluralizeIfNecessary(propertyInfo, element.getTagName().getLocalPart()));
return propertyName;
}
示例9: writeXmlElementAnnotation
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
/**
* 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 mostUsedURI = parent()._package().getMostUsedNamespaceURI();
String propName = prop.getName(false);
// 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(mostUsedURI)) ||
((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) || (parent().parent().getModel().options.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: resolve
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
/**
* 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: SingleWrappingElementField
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
public SingleWrappingElementField(ClassOutlineImpl context,
CPropertyInfo prop, CPropertyInfo core, CTypeRef typeRef) {
super(context, prop, core);
this.typeRef = typeRef;
}
示例12: getTypeRef
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
public CTypeRef getTypeRef() {
return typeRef;
}
示例13: createTypeProperties
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
protected Collection<CPropertyInfo> createTypeProperties(
final ProcessModel context, final CElementPropertyInfo propertyInfo) {
final Collection<? extends CTypeRef> types = context.getGetTypes().getTypes(context, propertyInfo);
// Set<CElement> elements = propertyInfo.getElements();
final Collection<CPropertyInfo> properties = new ArrayList<CPropertyInfo>(
types.size());
for (final CTypeRef type : types) {
final CElementPropertyInfo itemPropertyInfo = new CElementPropertyInfo(
propertyInfo.getName(true)
+ ((CClassInfo) propertyInfo.parent()).model
.getNameConverter().toPropertyName(
type.getTagName().getLocalPart()),
CollectionMode.NOT_REPEATED, ID.NONE, propertyInfo
.getExpectedMimeType(), propertyInfo
.getSchemaComponent(),
new CCustomizations(CustomizationUtils
.getCustomizations(propertyInfo)), propertyInfo
.getLocator(), false);
itemPropertyInfo.getTypes().add(type);
itemPropertyInfo.realization = new FieldRenderer() {
public FieldOutline generate(ClassOutlineImpl classOutline,
CPropertyInfo p) {
final SingleWrappingElementField field = new SingleWrappingElementField(
classOutline, p, propertyInfo, type);
field.generateAccessors();
return field;
}
};
Customizations.markGenerated(itemPropertyInfo);
properties.add(itemPropertyInfo);
Collection<CPropertyInfo> newProperties = context
.getProcessPropertyInfos().process(context,
itemPropertyInfo);
if (newProperties != null) {
properties.addAll(newProperties);
}
}
return properties;
}
示例14: getTypes
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
public Collection<? extends CTypeRef> getTypes(C context,
CElementPropertyInfo propertyInfo) {
return propertyInfo.getTypes();
}
示例15: getTypes
import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
public Collection<? extends CTypeRef> getTypes(C context,
CElementPropertyInfo propertyInfo);