Example usage for org.springframework.beans.factory.annotation Value value

List of usage examples for org.springframework.beans.factory.annotation Value value

Introduction

In this page you can find the example usage for org.springframework.beans.factory.annotation Value value.

Prototype

value

Source Link

Usage

From source file:org.apache.aries.blueprint.plugin.model.Property.java

public static Property create(Matcher matcher, Field field) {
    Value value = field.getAnnotation(Value.class);
    if (needsInject(field)) {
        Bean matching = matcher.getMatching(field);
        String ref = (matching == null) ? getRefName(field) : matching.id;
        return new Property(field.getName(), ref, null);
    } else if (value != null) {
        return new Property(field.getName(), null, cleanValue(value.value()));
    } else {//ww  w  .  j ava2 s . c  o  m
        // Field is not a property
        return null;
    }
}

From source file:org.kuali.coeus.s2sgen.impl.generate.support.stylesheet.StylesheetValidationTest.java

private Resource getXsltStylesheet(Class<? extends S2SFormGenerator> generatorClass) {
    try {//from  w ww  . j  av  a 2 s  .co  m
        final Field stylesheet = generatorClass.getDeclaredField("stylesheet");
        stylesheet.setAccessible(true);
        final Value value = stylesheet.getAnnotation(Value.class);
        final ResourceLoader resourceLoader = new DefaultResourceLoader(this.getClass().getClassLoader());
        return resourceLoader.getResource(value.value());
    } catch (NoSuchFieldException e) {
        throw new RuntimeException(generatorClass.getName() + " cannot find stylesheet", e);
    }
}

From source file:org.jasig.schedassist.impl.caldav.integration.CaldavIntegrationTest.java

/**
 * Reflect an {@link AvailableSchedule} into the owner's account and verify expected behavior.
 * /*from  w  w  w.j  a  v a  2 s.  c  o  m*/
 * @throws InputFormatException
 */
@Test
public void testReflectAvailabilitySchedule() throws InputFormatException {
    System.setProperty("org.jasig.schedassist.impl.caldav.reflectionEnabled", reflectionEnabled);
    if (Boolean.parseBoolean(reflectionEnabled)) {
        MockScheduleOwner owner1 = new MockScheduleOwner(ownerCalendarAccount1, 1);

        Date start = CommonDateOperations.parseDatePhrase("20110919");
        Date end = DateUtils.addDays(start, 12);

        Set<AvailableBlock> availableBlocks = AvailableBlockBuilder.createBlocks("9:00 AM", "3:00 PM", "MWF",
                start, end);
        AvailableSchedule schedule = new AvailableSchedule(availableBlocks);
        this.calendarDataDao.reflectAvailableSchedule(owner1, schedule);

        List<CalendarWithURI> results = this.calendarDataDao.peekAtAvailableScheduleReflections(owner1, start,
                end);
        Assert.assertEquals(1, results.size());
        CalendarWithURI calendar = results.get(0);
        VEvent event = (VEvent) calendar.getCalendar().getComponent(VEvent.VEVENT);
        Assert.assertTrue(event.getProperties().contains(AvailabilityReflection.TRUE));
        Assert.assertEquals("Available 9:00 AM - 3:00 PM", event.getSummary().getValue());
        Assert.assertTrue(event.getProperties().contains(Transp.TRANSPARENT));
        DtStart dtstart = event.getStartDate();
        Assert.assertEquals(net.fortuna.ical4j.model.parameter.Value.DATE,
                dtstart.getParameter(net.fortuna.ical4j.model.parameter.Value.VALUE));
        Assert.assertEquals("20110919", dtstart.getValue());

        PropertyList rdates = event.getProperties(RDate.RDATE);
        Assert.assertEquals(5, rdates.size());
        Set<String> rdateValues = new HashSet<String>();
        for (Object o : rdates) {
            Property rdate = (Property) o;
            Assert.assertEquals(net.fortuna.ical4j.model.parameter.Value.DATE,
                    rdate.getParameter(net.fortuna.ical4j.model.parameter.Value.VALUE));
            rdateValues.add(rdate.getValue());
        }

        Assert.assertTrue(rdateValues.contains("20110921"));
        Assert.assertTrue(rdateValues.contains("20110923"));
        Assert.assertTrue(rdateValues.contains("20110926"));
        Assert.assertTrue(rdateValues.contains("20110928"));
        Assert.assertTrue(rdateValues.contains("20110930"));

        this.calendarDataDao.purgeAvailableScheduleReflections(owner1, start, end);
        results = this.calendarDataDao.peekAtAvailableScheduleReflections(owner1, start, end);
        Assert.assertEquals(0, results.size());

    } else {
        log.debug("testReflectAvailabilitySchedule disabled");
    }
}