/** * Parse the text form as defined by the Assembly spec. * * @param text multiplicity value as text as described by the Assembly spec; may be null * @return the value corresponding to the text, or null if text is null * @throws IllegalArgumentException if the text is not a valid value */ public static Multiplicity fromString(String text) throws IllegalArgumentException { if (text == null) { return null; } for (Multiplicity multiplicity : Multiplicity.values()) { if (multiplicity.text.equals(text)) { return multiplicity; } } throw new IllegalArgumentException(text); } }
private void resolveReferences(LogicalComponent<?> component, InstantiationContext context) { LogicalCompositeComponent parent = component.getParent(); for (LogicalReference reference : component.getReferences()) { if (reference.isBound()) { // reference is targeted using binding.sca or is explicitly bound so it should not be autowired continue; } Multiplicity multiplicityValue = reference.getDefinition().getMultiplicity(); boolean refMultiplicity = multiplicityValue.equals(Multiplicity.ZERO_N) || multiplicityValue.equals(Multiplicity.ONE_N); if (refMultiplicity || !reference.isResolved()) { // Only resolve references that have not been resolved or ones that are multiplicities since the latter may be reinjected. // Explicitly set the reference to unresolved, since if it was a multiplicity it may have been previously resolved. reference.setResolved(false); resolveReference(reference, parent, context); } } }
private void resolveReferences(LogicalComponent<?> component, InstantiationContext context) { LogicalCompositeComponent parent = component.getParent(); for (LogicalReference reference : component.getReferences()) { if (reference.isBound()) { // reference is targeted using binding.sca or is explicitly bound so it should not be autowired continue; } Multiplicity multiplicityValue = reference.getDefinition().getMultiplicity(); boolean refMultiplicity = multiplicityValue.equals(Multiplicity.ZERO_N) || multiplicityValue.equals(Multiplicity.ONE_N); if (refMultiplicity || !reference.isResolved()) { // Only resolve references that have not been resolved or ones that are multiplicities since the latter may be reinjected. // Explicitly set the reference to unresolved, since if it was a multiplicity it may have been previously resolved. reference.setResolved(false); resolveReference(reference, parent, context); } } }
ServiceContract contract = reference.getServiceContract(); Multiplicity refMultiplicity = reference.getDefinition().getMultiplicity(); boolean multiplicity = Multiplicity.ZERO_N.equals(refMultiplicity) || Multiplicity.ONE_N.equals(refMultiplicity); for (LogicalComponent<?> child : composite.getComponents()) { if (reference.getParent() == child) {
ServiceContract contract = reference.getServiceContract(); Multiplicity refMultiplicity = reference.getDefinition().getMultiplicity(); boolean multiplicity = Multiplicity.ZERO_N.equals(refMultiplicity) || Multiplicity.ONE_N.equals(refMultiplicity); for (LogicalComponent<?> child : composite.getComponents()) { if (reference.getParent() == child) {