Package org.apache.tapestry.annotations

Examples of org.apache.tapestry.annotations.Inject


    @Test
    public void get_annotation_success()
    {
        Binding inner = mockBinding();
        Location l = mockLocation();
        Inject inject = newMock(Inject.class);

        train_getAnnotation(inner, Inject.class, inject);

        replay();
View Full Code Here


    @Test
    public void annotation_has_value()
    {
        ObjectProvider provider = mockObjectProvider();
        ObjectLocator locator = mockObjectLocator();
        Inject annotation = newMock(Inject.class);
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        Request injected = mockRequest();

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

    @Test
    public void provide_object_fails()
    {
        ObjectProvider provider = mockObjectProvider();
        ObjectLocator locator = mockObjectLocator();
        Inject annotation = newMock(Inject.class);
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        Throwable cause = new RuntimeException("Injection failed.");

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

    @Test
    public void anonymous_injection()
    {
        ObjectLocator locator = mockObjectLocator();
        InjectionProvider ip = newMock(InjectionProvider.class);
        Inject annotation = newMock(Inject.class);
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();

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

    @Test
    public void anonymous_injection_not_provided()
    {
        ObjectLocator locator = mockObjectLocator();
        InjectionProvider ip = newMock(InjectionProvider.class);
        Inject annotation = newMock(Inject.class);
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();

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

    @Test
    public void fields_with_annotations()
    {
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        Inject fredAnnotation = mockInject();
        Inject barneyAnnotation = mockInject();
        Id barneyId = newId();

        String barneyFieldName = "_barneyBlock";
        String fredFieldName = "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

        String resourcesFieldName = transformation.getResourcesFieldName();

        for (String fieldName : fieldNames)
        {
            Inject injectAnnotation = transformation.getFieldAnnotation(fieldName, Inject.class);

            if (injectAnnotation == null) continue;

            Id annotation = transformation.getFieldAnnotation(fieldName, Id.class);
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);

            inject(fieldName, transformation, model);

            transformation.claimField(fieldName, annotation);
        }
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;

            // This is tricky because we support sublcasses; if we ask the component at runtime for
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.