← Prev in month ← Prev in thread

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

From
Raymond Feng <>
Date
2009-02-23T21:09:34+00:00
ID
Thread
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 <>

To:


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
← Prev in month ← Prev in thread