當前位置: 首頁>>代碼示例>>Java>>正文


Java CTypeRef類代碼示例

本文整理匯總了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)));
	}
}
 
開發者ID:highsource,項目名稱:jaxb2-basics,代碼行數:21,代碼來源:SimplifyPlugin.java

示例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;
}
 
開發者ID:highsource,項目名稱:jaxb2-basics,代碼行數:19,代碼來源:SimplifyPlugin.java

示例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;
}
 
開發者ID:highsource,項目名稱:hyperjaxb3,代碼行數:20,代碼來源:AbstractAdaptPropertyInfo.java

示例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;
	}
}
 
開發者ID:highsource,項目名稱:jaxb2-basics,代碼行數:11,代碼來源:XJCCMInfoFactory.java

示例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;
	}
}
 
開發者ID:highsource,項目名稱:jaxb2-basics,代碼行數:14,代碼來源:XJCCMElementTypeRefOrigin.java

示例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;
}
 
開發者ID:bulldog2011,項目名稱:mxjc,代碼行數:15,代碼來源:ClassModelBuilder.java

示例7: createElementTypeRefOrigin

import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
@Override
protected MElementTypeRefOrigin createElementTypeRefOrigin(
		CElementPropertyInfo ep, CTypeRef typeRef) {
	return new XJCCMElementTypeRefOrigin(ep, typeRef);
}
 
開發者ID:highsource,項目名稱:jaxb2-basics,代碼行數:6,代碼來源:XJCCMInfoFactory.java

示例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;
}
 
開發者ID:highsource,項目名稱:jaxb2-basics,代碼行數:7,代碼來源:SimplifyPlugin.java

示例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);
    }
}
 
開發者ID:highsource,項目名稱:hyperjaxb3,代碼行數:78,代碼來源:AbstractField.java

示例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);
}
 
開發者ID:highsource,項目名稱:hyperjaxb3,代碼行數:7,代碼來源:AbstractField.java

示例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;
}
 
開發者ID:highsource,項目名稱:hyperjaxb3,代碼行數:6,代碼來源:SingleWrappingElementField.java

示例12: getTypeRef

import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
public CTypeRef getTypeRef() {
	return typeRef;
}
 
開發者ID:highsource,項目名稱:hyperjaxb3,代碼行數:4,代碼來源:SingleWrappingElementField.java

示例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;
}
 
開發者ID:highsource,項目名稱:hyperjaxb3,代碼行數:49,代碼來源:WrapSingleHeteroElement.java

示例14: getTypes

import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
public Collection<? extends CTypeRef> getTypes(C context,
		CElementPropertyInfo propertyInfo) {
	return propertyInfo.getTypes();
}
 
開發者ID:highsource,項目名稱:hyperjaxb3,代碼行數:5,代碼來源:DefaultGetTypes.java

示例15: getTypes

import com.sun.tools.xjc.model.CTypeRef; //導入依賴的package包/類
public Collection<? extends CTypeRef> getTypes(C context,
CElementPropertyInfo propertyInfo);
 
開發者ID:highsource,項目名稱:hyperjaxb3,代碼行數:3,代碼來源:GetTypes.java


注:本文中的com.sun.tools.xjc.model.CTypeRef類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。