Search in sources :

Example 1 with ClassAvailableActivation

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

the class BeansXmlStreamParser method classAvailable.

private void classAvailable(StartElement element, Consumer<Metadata<ClassAvailableActivation>> consumer, boolean inverse) {
    String className = getAttribute(element, NAME_ATTRIBUTE_NAME);
    Metadata<ClassAvailableActivation> classAvailableActivation = new XmlMetadata<ClassAvailableActivation>(element.getName().toString(), new ClassAvailableActivationImpl(className, inverse), beansXml, element.getLocation().getLineNumber());
    consumer.accept(classAvailableActivation);
}
Also used : ClassAvailableActivation(org.jboss.weld.bootstrap.spi.ClassAvailableActivation) ClassAvailableActivationImpl(org.jboss.weld.metadata.ClassAvailableActivationImpl)

Example 2 with ClassAvailableActivation

use of org.jboss.weld.bootstrap.spi.ClassAvailableActivation 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

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