Search in sources :

Example 1 with SystemPropertyActivation

use of org.jboss.weld.bootstrap.spi.SystemPropertyActivation in project core by weld.

the class BeansXmlStreamParser method systemProperty.

private void systemProperty(StartElement element, Consumer<Metadata<SystemPropertyActivation>> consumer) {
    String name = getAttribute(element, NAME_ATTRIBUTE_NAME);
    String value = getAttribute(element, VALUE_ATTRIBUTE_NAME);
    Metadata<SystemPropertyActivation> activation = new XmlMetadata<SystemPropertyActivation>(element.getName().toString(), new SystemPropertyActivationImpl(name, value), beansXml, element.getLocation().getLineNumber());
    consumer.accept(activation);
}
Also used : SystemPropertyActivation(org.jboss.weld.bootstrap.spi.SystemPropertyActivation) SystemPropertyActivationImpl(org.jboss.weld.metadata.SystemPropertyActivationImpl)

Example 2 with SystemPropertyActivation

use of org.jboss.weld.bootstrap.spi.SystemPropertyActivation in project core by weld.

the class JsonObjects method createFilterJsonArray.

static JsonObjectBuilder createFilterJsonArray(Filter filter, String type) {
    JsonObjectBuilder filterBuilder = Json.objectBuilder(true);
    filterBuilder.add(TYPE, type);
    filterBuilder.add(NAME, filter.getName());
    JsonArrayBuilder activationsBuilder = Json.arrayBuilder(true);
    filterBuilder.add(ACTIVATIONS, activationsBuilder);
    if (filter.getClassAvailableActivations() != null && !filter.getClassAvailableActivations().isEmpty()) {
        for (Metadata<ClassAvailableActivation> metadata : filter.getClassAvailableActivations()) {
            activationsBuilder.add(Json.objectBuilder().add(INVERTED, metadata.getValue().isInverted()).add(CLASS_AVAILABILITY, metadata.getValue().getClassName()));
        }
    }
    if (filter.getSystemPropertyActivations() != null && !filter.getSystemPropertyActivations().isEmpty()) {
        for (Metadata<SystemPropertyActivation> metadata : filter.getSystemPropertyActivations()) {
            JsonObjectBuilder sysPropBuilder = Json.objectBuilder().add(SYS_PROPERTY, metadata.getValue().getName());
            if (metadata.getValue().getValue() != null) {
                sysPropBuilder.add(VALUE, metadata.getValue().getValue());
            }
            activationsBuilder.add(sysPropBuilder);
        }
    }
    return filterBuilder;
}
Also used : ClassAvailableActivation(org.jboss.weld.bootstrap.spi.ClassAvailableActivation) SystemPropertyActivation(org.jboss.weld.bootstrap.spi.SystemPropertyActivation) JsonArrayBuilder(org.jboss.weld.probe.Json.JsonArrayBuilder) JsonObjectBuilder(org.jboss.weld.probe.Json.JsonObjectBuilder)

Aggregations

SystemPropertyActivation (org.jboss.weld.bootstrap.spi.SystemPropertyActivation)2 ClassAvailableActivation (org.jboss.weld.bootstrap.spi.ClassAvailableActivation)1 SystemPropertyActivationImpl (org.jboss.weld.metadata.SystemPropertyActivationImpl)1 JsonArrayBuilder (org.jboss.weld.probe.Json.JsonArrayBuilder)1 JsonObjectBuilder (org.jboss.weld.probe.Json.JsonObjectBuilder)1