OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

sca-j message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [sca-j] Why is @Property.required attribute MUST be true forconstructor parameter?


My understanding is that @required=true means the property MUST be set with a value which can be either configured at the component level or inherited from the componentType.

For example, if we have a constructor as follows:

public MyServiceImpl(@Property(name="myProp") String myProp) {
        ...
}

The injection for "myProp" is required no matter what value it is set.

Thanks,
Raymond



From: C Vamsi <vamsic007@in.ibm.com>
To: sca-j@lists.oasis-open.org
Date: 02/23/2009 10:41 AM
Subject: [sca-j] Why is @Property.required attribute MUST be true for constructor parameter?





sca-javacaa-1.1-spec-cd02-rev2.doc:

Sec 9.15 @Property

Lines 1622-1623:
required (optional) – specifies whether injection is required, defaults to
true. For a constructor parameter annotation, this attribute MUST have the
value true.

Q: Why is, "For a constructor parameter annotation, this attribute MUST
have the value true." required?

The componentType can define a default value for the property. In this
case, even if a property is not specified in the component definition, the
runtime will still have a value to pass as an argument to the constructor.


++Vamsi
Apache Tuscany Committer  
http://tuscany.apache.org
Apache Geronimo Committer and Member of PMC  
http://geronimo.apache.org

S/MIME Cryptographic Signature



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]