private Property createDefinition(String name, boolean required, Type type, TypeMapping typeMapping) { Property property = new Property(name); property.setRequired(required); MultiplicityType multiplicityType = helper.introspectMultiplicity(type, typeMapping); property.setMany(MultiplicityType.COLLECTION == multiplicityType || MultiplicityType.DICTIONARY == multiplicityType); return property; }
/** * Adds a property to the composite parsed from the XML source. * * @param name the property name * @param source the XML source * @return the builder * @throws ModelBuilderException if an error reading the source occurs */ public CompositeBuilder property(String name, URL source) { checkState(); try { Document document = DOCUMENT_FACTORY.newDocumentBuilder().parse(source.openStream()); // all properties have a root <values> element, append the existing root to it. The existing root will be taken as a property <value>. Element oldRoot = document.getDocumentElement(); Element newRoot = document.createElement("values"); document.removeChild(oldRoot); document.appendChild(newRoot); newRoot.appendChild(oldRoot); Property property = new Property(name); property.setDefaultValue(document); composite.add(property); } catch (IOException | ParserConfigurationException | SAXException e) { throw new ModelBuilderException(e); } return this; }
private void addProperty(InjectingComponentType componentType, TypeMapping typeMapping, String name, Type type, InjectionSite site) { Property property = new Property(name); MultiplicityType multiplicityType = helper.introspectMultiplicity(type, typeMapping); property.setMany(MultiplicityType.COLLECTION == multiplicityType || MultiplicityType.DICTIONARY == multiplicityType); componentType.add(property, site); }
private void addProperty(InjectingComponentType componentType, String name, Type type, Class<?> declaringClass, InjectionSite site, IntrospectionContext context) { TypeMapping typeMapping = context.getTypeMapping(declaringClass); Property property = new Property(name); MultiplicityType multiplicityType = helper.introspectMultiplicity(type, typeMapping); property.setMany(MultiplicityType.COLLECTION == multiplicityType || MultiplicityType.DICTIONARY == multiplicityType); componentType.add(property, site); }
Property property = new Property(name); property.setRequired(true);
Property property = new Property(name); property.setRequired(true);