boolean required = property.isRequired(); PropertyValue propertyValue = propertyValues.get(name); if (propertyValue != null && propertyValue.getInstanceValue() != null) { Object value = propertyValue.getInstanceValue(); LogicalProperty logicalProperty = LogicalProperty.Builder.newBuilder(name, logicalComponent).instanceValue(value).build(); logicalComponent.setProperties(logicalProperty); nsContext.add(entry.getKey(), entry.getValue()); propertyValue = new PropertyValue("name", source); value = deriveValueFromXPath(propertyValue, parent, nsContext); } catch (PropertyTypeException e) { if (propertyValue.getFile() != null) { value = loadValueFromFile(property.getName(), propertyValue.getFile(), logicalComponent, context); } else if (propertyValue.getSource() != null) { NamespaceContext nsContext = propertyValue.getNamespaceContext(); value = deriveValueFromXPath(propertyValue, parent, nsContext); } catch (PropertyTypeException e) { value = propertyValue.getValue(); logicalComponent.setProperties(logicalProperty); } else if (property.isRequired() && value == null && (propertyValue == null || (propertyValue != null && propertyValue.getInstanceValue() == null))) {
return null; if (propertyValue.getType() != null && property.getType() != null && !propertyValue.getType().equals(property.getType())) { throw new PropertyTypeException("Property types are incompatible:" + name + " and " + propertyValue.getName()); Element root = document.createElement("values"); document.appendChild(root); String source = propertyValue.getSource(); try { source = parseSource(source);
/** * Adds a property value sourced from the XPath expression. * * @param name the property name * @param xpath the XPath expression * @return the builder */ public T propertyExpression(String name, String xpath) { checkState(); PropertyValue propertyValue = new PropertyValue(name, xpath); propertyValue.setNamespaceContext(new F3NamespaceContext()); getComponent().add(propertyValue); return builder(); }
/** * Adds a property value. * * @param name the property name * @param value the value * @return the builder */ public T property(String name, Object value) { checkState(); PropertyValue propertyValue = new PropertyValue(name, value); getComponent().add(propertyValue); return builder(); }
boolean required = property.isRequired(); PropertyValue propertyValue = propertyValues.get(name); if (propertyValue != null && propertyValue.getInstanceValue() != null) { Object value = propertyValue.getInstanceValue(); LogicalProperty logicalProperty = LogicalProperty.Builder.newBuilder(name, logicalComponent).instanceValue(value).build(); logicalComponent.setProperties(logicalProperty); nsContext.add(entry.getKey(), entry.getValue()); propertyValue = new PropertyValue("name", source); value = deriveValueFromXPath(propertyValue, parent, nsContext); } catch (PropertyTypeException e) { if (propertyValue.getFile() != null) { value = loadValueFromFile(property.getName(), propertyValue.getFile(), logicalComponent, context); } else if (propertyValue.getSource() != null) { NamespaceContext nsContext = propertyValue.getNamespaceContext(); value = deriveValueFromXPath(propertyValue, parent, nsContext); } catch (PropertyTypeException e) { value = propertyValue.getValue(); logicalComponent.setProperties(logicalProperty); } else if (property.isRequired() && value == null && (propertyValue == null || (propertyValue != null && propertyValue.getInstanceValue() == null))) {
return null; if (propertyValue.getType() != null && property.getType() != null && !propertyValue.getType().equals(property.getType())) { throw new PropertyTypeException("Property types are incompatible:" + name + " and " + propertyValue.getName()); Element root = document.createElement("values"); document.appendChild(root); String source = propertyValue.getSource(); try { source = parseSource(source);