Package org.apache.tapestry.annotations

Examples of org.apache.tapestry.annotations.Inject


    @Test
    public void asset_field_annotation_has_blank_value()
    {
        ClassTransformation ct = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();
        Inject annotation = newMock(Inject.class);

        train_findFieldsOfType(ct, InjectAssetWorker.ASSET_TYPE_NAME, "_fred");

        train_getFieldAnnotation(ct, "_fred", Inject.class, annotation);
View Full Code Here


    @Test
    public void asset_field_with_full_annotation()
    {
        ClassTransformation ct = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();
        Inject annotation = newMock(Inject.class);
        AssetSource source = newMock(AssetSource.class);
        Resource r = newResource();

        train_findFieldsOfType(ct, InjectAssetWorker.ASSET_TYPE_NAME, "_fred");
View Full Code Here

    public void transform(ClassTransformation transformation, MutableComponentModel model)
    {
        for (String fieldName : transformation.findFieldsWithAnnotation(Inject.class))
        {
            Inject annotation = transformation.getFieldAnnotation(fieldName, Inject.class);

            String fieldType = transformation.getFieldType(fieldName);

            boolean result = _injectionProvider.provideInjection(
                    fieldName,
View Full Code Here

        builder.begin();

        for (String name : names)
        {

            Inject annotation = transformation.getFieldAnnotation(name, Inject.class);

            // If the field has no annotation, or no value for its annotation, that's probably
            // a programmer error, but we'll let the later Inject-related workers complain about it.

            if (annotation == null)
                continue;

            String path = annotation.value();

            if (path.equals(""))
                continue;
           
            String expandedPath = _symbolSource.expandSymbols(path);
View Full Code Here

    @Test
    public void annotation_has_value()
    {
        ObjectProvider provider = newObjectProvider();
        ServiceLocator locator = newServiceLocator();
        Inject annotation = newMock(Inject.class);
        ClassTransformation ct = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();
        Request injected = newRequest();

        train_findFieldsWithAnnotation(ct, Inject.class, "myfield");
View Full Code Here

    @Test
    public void anonymous_injection()
    {
        ServiceLocator locator = newServiceLocator();
        InjectionProvider ip = newMock(InjectionProvider.class);
        Inject annotation = newMock(Inject.class);
        ClassTransformation ct = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();

        train_findFieldsWithAnnotation(ct, Inject.class, "myfield");
        train_getFieldAnnotation(ct, "myfield", Inject.class, annotation);
View Full Code Here

    @Test
    public void anonymous_injection_not_provided()
    {
        ServiceLocator locator = newServiceLocator();
        InjectionProvider ip = newMock(InjectionProvider.class);
        Inject annotation = newMock(Inject.class);
        ClassTransformation ct = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();

        train_findFieldsWithAnnotation(ct, Inject.class, "myfield");
        train_getFieldAnnotation(ct, "myfield", Inject.class, annotation);
View Full Code Here

    @Test
    public void asset_field_annotation_has_blank_value()
    {
        ClassTransformation ct = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();
        Inject annotation = newMock(Inject.class);

        train_findFieldsOfType(ct, InjectAssetWorker.ASSET_TYPE_NAME, "_fred");

        train_getFieldAnnotation(ct, "_fred", Inject.class, annotation);
View Full Code Here

    @Test
    public void asset_field_with_full_annotation()
    {
        ClassTransformation ct = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();
        Inject annotation = newMock(Inject.class);
        AssetSource source = newAssetSource();
        Resource r = newResource();
        SymbolSource symbolSource = newSymbolSource();

        train_findFieldsOfType(ct, InjectAssetWorker.ASSET_TYPE_NAME, "_fred");
View Full Code Here

    @Test
    public void fields_with_annotations()
    {
        ClassTransformation ct = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();
        Inject fredAnnotation = newInject();
        Inject barneyAnnotation = newInject();

        train_findFieldsOfType(ct, InjectBlockWorker.BLOCK_TYPE_NAME, "fred", "_barneyBlock");

        train_getResourcesFieldName(ct, "rez");
View Full Code Here

TOP

Related Classes of org.apache.tapestry.annotations.Inject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.