Schema schema, ElementTransform transform) { Map<QName, AttributeKey<?>> union = Maps.newLinkedHashMap(); Set<QName> base = getAttributeNames(transform); Set<QName> invalid = Sets.newHashSet(); if (!checkCompatible(existing, key)) { union.remove(id); invalid.add(id);
/** * Constructs a new adaptation registry from the given transform. */ static AdaptationRegistry create(Schema schema, ElementTransform transform) { return new AdaptationRegistry(transform.getAdaptations(), unionAttributes(schema, transform), unionElements(schema, transform)); }
Map<QName, ElementKey<?, ?>> union = Maps.newLinkedHashMap(); Set<QName> invalid = Sets.newHashSet(); Set<QName> base = getElementNames(transform); compatible = checkCompatibleElements(existing, key);
/** * Checks that two element keys are compatible. This checks that the element * types are compatible and the datatypes are the same. If the keys are not * compatible we log a warning explaining why and return {@code null}. If the * element types of the two elements are not the same, but one is a supertype * of the other, we use the supertype, so we parse into the most general type * first and later adapt to a more specific type if necessary. */ private static ElementKey<?, ?> checkCompatibleElements( ElementKey<?, ?> first, ElementKey<?, ?> second) { ElementKey<?, ?> match = first; boolean compatible = true; if (!checkCompatible(first, second)) { compatible = false; } Class<? extends Element> firstType = first.getElementType(); Class<? extends Element> secondType = second.getElementType(); if (firstType != secondType && !firstType.isAssignableFrom(secondType)) { if (secondType.isAssignableFrom(firstType)) { match = second; } else { logger.warning("Incompatible element types." + " First(" + first + "): " + firstType + " but Second(" + second + "): " + secondType); compatible = false; } } return compatible ? match : null; }
this.adaptations = null; } else { this.adaptations = AdaptationRegistryFactory.create(schema, transform);
Map<QName, ElementKey<?, ?>> union = Maps.newLinkedHashMap(); Set<QName> invalid = Sets.newHashSet(); Set<QName> base = getElementNames(transform); compatible = checkCompatibleElements(existing, key);
/** * Checks that two element keys are compatible. This checks that the element * types are compatible and the datatypes are the same. If the keys are not * compatible we log a warning explaining why and return {@code null}. If the * element types of the two elements are not the same, but one is a supertype * of the other, we use the supertype, so we parse into the most general type * first and later adapt to a more specific type if necessary. */ private static ElementKey<?, ?> checkCompatibleElements( ElementKey<?, ?> first, ElementKey<?, ?> second) { ElementKey<?, ?> match = first; boolean compatible = true; if (!checkCompatible(first, second)) { compatible = false; } Class<? extends Element> firstType = first.getElementType(); Class<? extends Element> secondType = second.getElementType(); if (firstType != secondType && !firstType.isAssignableFrom(secondType)) { if (secondType.isAssignableFrom(firstType)) { match = second; } else { logger.warning("Incompatible element types." + " First(" + first + "): " + firstType + " but Second(" + second + "): " + secondType); compatible = false; } } return compatible ? match : null; }
this.adaptations = null; } else { this.adaptations = AdaptationRegistryFactory.create(schema, transform);
/** * Constructs a new adaptation registry from the given transform. */ static AdaptationRegistry create(Schema schema, ElementTransform transform) { return new AdaptationRegistry(transform.getAdaptations(), unionAttributes(schema, transform), unionElements(schema, transform)); }
Map<QName, ElementKey<?, ?>> union = Maps.newLinkedHashMap(); Set<QName> invalid = Sets.newHashSet(); Set<QName> base = getElementNames(transform); compatible = checkCompatibleElements(existing, key);
Schema schema, ElementTransform transform) { Map<QName, AttributeKey<?>> union = Maps.newLinkedHashMap(); Set<QName> base = getAttributeNames(transform); Set<QName> invalid = Sets.newHashSet(); if (!checkCompatible(existing, key)) { union.remove(id); invalid.add(id);
/** * Checks that two element keys are compatible. This checks that the element * types are compatible and the datatypes are the same. If the keys are not * compatible we log a warning explaining why and return {@code null}. If the * element types of the two elements are not the same, but one is a supertype * of the other, we use the supertype, so we parse into the most general type * first and later adapt to a more specific type if necessary. */ private static ElementKey<?, ?> checkCompatibleElements( ElementKey<?, ?> first, ElementKey<?, ?> second) { ElementKey<?, ?> match = first; boolean compatible = true; if (!checkCompatible(first, second)) { compatible = false; } Class<? extends Element> firstType = first.getElementType(); Class<? extends Element> secondType = second.getElementType(); if (firstType != secondType && !firstType.isAssignableFrom(secondType)) { if (secondType.isAssignableFrom(firstType)) { match = second; } else { logger.warning("Incompatible element types." + " First(" + first + "): " + firstType + " but Second(" + second + "): " + secondType); compatible = false; } } return compatible ? match : null; }
this.adaptations = null; } else { this.adaptations = AdaptationRegistryFactory.create(schema, transform);
/** * Constructs a new adaptation registry from the given transform. */ static AdaptationRegistry create(Schema schema, ElementTransform transform) { return new AdaptationRegistry(transform.getAdaptations(), unionAttributes(schema, transform), unionElements(schema, transform)); }
Schema schema, ElementTransform transform) { Map<QName, AttributeKey<?>> union = Maps.newLinkedHashMap(); Set<QName> base = getAttributeNames(transform); Set<QName> invalid = Sets.newHashSet(); if (!checkCompatible(existing, key)) { union.remove(id); invalid.add(id);