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: [NEW ISSUE] Java C&I Constrctor Examples are incorrect



Raiser:                Mike Edwards        

Target:                sca-javaci-1.1-spec-wd03.pdf

Description:

The constructor examples in section 5 contain errors that make some of them illegal and they must be fixed.

/** Simple class taking a single property value */

public class Impl1 {

    String someProperty;

    public Impl1(String propval) {...}

}

<mje> This one does not "unambiguously identify all property and reference values"</mje>

/** Simple class taking a property and reference in the constructor;

 * The values are not injected into the fields.

 *//

public class Impl2 {

    public String someProperty;

    public SomeService someReference;

    public Impl2(String a, SomeService b) {...}

}

<mje> This one does not "unambiguously identify all property and reference values"</mje>

/** Class declaring a named property and reference through the constructor */

public class Impl3 {

    @Constructor({"someProperty", "someReference"})

    public Impl3(String a, SomeService b) {...}

}

<mje>@Constructor annotation has no such attributes (see [JAVACAA]) </mje>

/** Class declaring a named property and reference through parameters */

public class Impl3b {

    public Impl3b(

        @Property("someProperty") String a,

        @Reference("someReference) SomeService b

        ) {...}

}

<mje>This one is OK</mje>

/** Additional property set through a method */

public class Impl4 {

    public String someProperty;

    public SomeService someReference;

    public Impl2(String a, SomeService b) {...}

    @Property public void setAnotherProperty(int x) {...}

}

<mje> This one does not "unambiguously identify all property and reference values"</mje>


Proposal:

Replace the examples with the following ones:

/** Constructor declared using @Constructor annotation */

public class Impl1 {

    private String someProperty;

    @Constructor

    public Impl1( @Property("someProperty") String propval ) {...}

}

/** Declared constructor unambiguously identifying all Property and Reference values */

public class Impl2 {

    private String someProperty;

    private SomeService someReference;

    public Impl2( @Property("someProperty") String a,

                  @Reference("someReference") SomeService b )

    {...}

}

/** Declared constructor unambiguously identifying all Property and Reference values

    plus an additional Property injected via a setter method */

public class Impl3 {

    private String someProperty;

    private String anotherProperty;

    private SomeService someReference;

    public Impl3( @Property("someProperty") String a,

                  @Reference("someReference") SomeService b)

    {...}

    @Property

    public void setAnotherProperty( String anotherProperty ) {...}

}

/** No-arg constructor */

public class Impl4 {

    @Property

    public String someProperty;

    @Reference

    public SomeService someReference;

    public Impl4() {...}

}


Yours,  Mike.

Strategist - Emerging Technologies, SCA & SDO.
Co Chair OASIS SCA Assembly TC.
IBM Hursley Park, Mail Point 146, Winchester, SO21 2JN, Great Britain.
Phone & FAX: +44-1962-818014    Mobile: +44-7802-467431  
Email:  mike_edwards@uk.ibm.com





Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU








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