Java Code Examples for com.sun.tools.xjc.model.CPropertyInfo#getSchemaComponent()

The following examples show how to use com.sun.tools.xjc.model.CPropertyInfo#getSchemaComponent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdaptBuiltinTypeUse.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public TypeUse process(ProcessModel context, CPropertyInfo propertyInfo) {
	// propertyInfo.g
	final TypeUse type = context.getGetTypes().getTypeUse(context,
			propertyInfo);
	final XSComponent schemaComponent = propertyInfo.getSchemaComponent();

	if (schemaComponent != null) {
		final List<QName> typeNames = TypeUtils
				.getTypeNames(schemaComponent);

		for (QName typeName : typeNames) {
			final PropertyType propertyType = new PropertyType(type,
					typeName);
			if (adapters.containsKey(propertyType)) {
				final TypeUse createPropertyInfos = adapters
						.get(propertyType);
				return createPropertyInfos;
			}
		}
		return adapters.get(new PropertyType(type));

	} else {
		return adapters.get(new PropertyType(type));
	}
}
 
Example 2
Source File: AbstractAdaptPropertyInfo.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public XSComponent getSchemaComponent(ProcessModel context,
		CPropertyInfo propertyInfo) {
	return propertyInfo.getSchemaComponent();
}
 
Example 3
Source File: DefaultCustomizing.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Basic getDefaultBasic(CPropertyInfo property) throws AssertionError {
	final Persistence persistence = getModelCustomization(property);
	if (persistence.getDefaultBasic() == null) {
		throw new AssertionError("Default basic element is not provided.");
	}

	final Basic defaultBasic;
	final XSComponent schemaComponent = property.getSchemaComponent();
	if (schemaComponent == null) {
		defaultBasic = (Basic) persistence.getDefaultBasic().copyTo(
				new Basic());
	} else {
		final List<QName> typeNames = TypeUtils
				.getTypeNames(schemaComponent);
		Basic basic = null;
		for (Iterator<QName> typeNameIterator = typeNames.iterator(); typeNameIterator
				.hasNext() && basic == null;) {
			final QName typeName = typeNameIterator.next();
			final SingleProperty singleProperty = getDefaultSingleProperty(
					persistence, typeName);
			if (singleProperty != null) {
				if (singleProperty.getBasic() != null) {
					basic = singleProperty.getBasic();
				} else {
					logger.warn("Default single property for type ["
							+ typeName
							+ "] does not define the expected basic mapping.");
				}
			}
		}
		if (basic == null) {
			defaultBasic = (Basic) persistence.getDefaultBasic().copyTo(
					new Basic());
		} else {
			defaultBasic = (Basic) basic.copyTo(new Basic());
			mergeFrom(defaultBasic, (Basic) persistence.getDefaultBasic()
					.copyTo(new Basic()));
		}
	}

	final Column column = defaultBasic.getColumn();
	if (column != null) {

		assignColumn$LengthPrecisionScale(property, column);
	}
	return defaultBasic;
}
 
Example 4
Source File: DefaultCustomizing.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ElementCollection getDefaultElementCollection(CPropertyInfo property)
		throws AssertionError {
	final Persistence persistence = getModelCustomization(property);
	if (persistence.getDefaultElementCollection() == null) {
		throw new AssertionError(
				"Default element collection element is not provided.");
	}

	final ElementCollection defaultItem;
	final XSComponent schemaComponent = property.getSchemaComponent();
	if (schemaComponent == null) {
		defaultItem = (ElementCollection) persistence
				.getDefaultElementCollection().copyTo(
						new ElementCollection());
	} else {
		final List<QName> typeNames = TypeUtils
				.getTypeNames(schemaComponent);
		ElementCollection item = null;
		for (Iterator<QName> typeNameIterator = typeNames.iterator(); typeNameIterator
				.hasNext() && item == null;) {
			final QName typeName = typeNameIterator.next();
			final CollectionProperty collectionProperty = getDefaultCollectionProperty(
					persistence, typeName);
			if (collectionProperty != null) {
				if (collectionProperty.getElementCollection() != null) {
					item = collectionProperty.getElementCollection();
				} else {
					logger.warn("Default single property for type ["
							+ typeName
							+ "] does not define the expected basic mapping.");
				}
			}
		}
		if (item == null) {
			defaultItem = (ElementCollection) persistence
					.getDefaultElementCollection().copyTo(
							new ElementCollection());
		} else {
			defaultItem = (ElementCollection) item
					.copyTo(new ElementCollection());
			mergeFrom(
					defaultItem,
					(ElementCollection) persistence
							.getDefaultElementCollection().copyTo(
									new ElementCollection()));
		}
	}

	if (defaultItem.getColumn() != null) {
		assignColumn$LengthPrecisionScale(property, defaultItem.getColumn());
	}
	return defaultItem;
}