/** * Determine if any value (default or explicit) is present. * * @return <code>true</code> is a value is present, otherwise <code>false</code>. */ public boolean isPresent() { return get(false) != null; }
/** * Retrieve the value, regardless of it's origin. * * @return The value, if non-null. * @throws NoSuchElementException If no value (default nor explicit) is present. */ public T get() throws NoSuchElementException { return get(true); }
/** * Retrieve the value (default or explicit) if present, otherwise the provided value parameter. * * @param defaultValue The value to return only if no value is present. * @return Either the value (default or explicit) or the <code>defaultValue</code> parameter. */ public T orElse(T defaultValue) { T value = get(); if (value != null) { return value; } return defaultValue; }
/** * Retrieve the name of the connection. * * @return The name. */ public String name() { return this.name.get(); }
/** * Retrieve the port (or port expression). * * @return The port (or port expression). */ public int port() { return this.port.get(); }
@SuppressWarnings("unchecked") @Override public <T> T currentValue() throws IllegalAccessException { Object value = this.field.get(this.instance); if (value instanceof Defaultable) { return ((Defaultable<T>) value).get(); } return (T) value; }
/** * Retrieve the value (default or explicit) if present, otherwise return the value supplied by the <code>Supplier</code> parameter. * * @param other The value supplier to use to supply a value only if no value is present. * @return Either the value (default or explicit) or the value supplied by the <code>other</code> <code>Supplier</code> parameter. */ public T orElseGet(Supplier<? extends T> other) { T value = get(); return value != null ? value : other.get(); }
/** * If a default or explicit value is present, invoke the supplied consumer with it. * * @param consumer The consumer. */ public void ifPresent(Consumer<? super T> consumer) { T value = get(false); if (value != null) { consumer.accept(value); } }
@SuppressWarnings("unchecked") @Override public <T> T currentValue() throws IllegalAccessException { Object value = this.field.get(this.instance); if (value instanceof Defaultable) { return ((Defaultable<T>) value).get(); } return (T) value; }
@SuppressWarnings("unchecked") @Override public <T> T currentValue() throws IllegalAccessException { Object value = this.field.get(this.instance); if (value instanceof Defaultable) { return ((Defaultable<T>) value).get(); } return (T) value; }
/** * Retrieve the value (default or explicit) if present, otherwise return the value supplied by the <code>Supplier</code> parameter. * * @param other The value supplier to use to supply a value only if no value is present. * @return Either the value (default or explicit) or the value supplied by the <code>other</code> <code>Supplier</code> parameter. */ public T orElseGet(Supplier<? extends T> other) { T value = get(); return value != null ? value : other.get(); }
/** * If a default or explicit value is present, invoke the supplied consumer with it. * * @param consumer The consumer. */ public void ifPresent(Consumer<? super T> consumer) { T value = get(false); if (value != null) { consumer.accept(value); } }
/** * If (and only if) only a default value is present (without an explicit value), invoke the supplied consumer with it. * * @param consumer The consumer. */ public void ifDefault(Consumer<? super T> consumer) { if (isDefault()) { consumer.accept(get()); } }
/** * If (and only if) an explicit value is present, invoke the supplied consumer with it * * @param consumer The consumer. */ public void ifExplicit(Consumer<? super T> consumer) { if (isExplicit()) { consumer.accept(get()); } }
/** * If (and only if) an explicit value is present, invoke the supplied consumer with it * * @param consumer The consumer. */ public void ifExplicit(Consumer<? super T> consumer) { if (isExplicit()) { consumer.accept(get()); } }
private void addGeneratedApplication(JAXRSArchive archive) { String name = "org.wildfly.swarm.generated.WildFlySwarmDefaultJAXRSApplication"; String path = "WEB-INF/classes/" + name.replace('.', '/') + ".class"; byte[] generatedApp; try { generatedApp = DefaultApplicationFactory.create(name, applicationPath.get()); archive.add(new ByteArrayAsset(generatedApp), path); archive.addHandlers(new ApplicationHandler(archive, path)); } catch (IOException e) { e.printStackTrace(); } }
@Override public void customize() throws Exception { if (fraction.policyDeciderModule() == null) { fraction.policyDeciderModule("org.jboss.teiid"); } // when odata is secured through Keycloak, it uses "other" as security-domain. if (secure.get() && fraction.authenticationSecurityDomain() == null) { fraction.authenticationSecurityDomain("other"); } } }
@Override public void customize() throws Exception { if (fraction.policyDeciderModule() == null) { fraction.policyDeciderModule("org.jboss.teiid"); } // when odata is secured through Keycloak, it uses "other" as security-domain. if (secure.get() && fraction.authenticationSecurityDomain() == null) { fraction.authenticationSecurityDomain("other"); } } }
public void customize() { this.group.socketBinding( new SocketBinding("management-http") .iface(iface.get()) .port(fraction.httpPort())); this.group.socketBinding(new SocketBinding("management-https") .port(fraction.httpsPort())); if (fraction.isHttpDisable()) { fraction.httpInterfaceManagementInterface((HTTPInterfaceManagementInterface<?>) null); } }
public void customize() { this.group.socketBinding( new SocketBinding("management-http") .iface(iface.get()) .port(fraction.httpPort())); this.group.socketBinding(new SocketBinding("management-https") .port(fraction.httpsPort())); if (fraction.isHttpDisable()) { fraction.httpInterfaceManagementInterface((HTTPInterfaceManagementInterface<?>) null); } }