Class Wiring

java.lang.Object
com.codename1.backend.Wiring

public final class Wiring extends Object

What the build-generated wiring calls: configuration placeholders, the conversions a @Value needs, and the conditions of conditional beans.

Everything here runs once, at start-up, from straight-line code the build wrote. None of it looks up a bean: the build already decided which bean goes where.

  • Method Details

    • value

      public static String value(Config config, String expression, String where)

      Resolves every ${key} and ${key:fallback} in expression against the configuration, keeping the text around them.

      Parameters
      • where: the injection point, for the refusal when a key has no value
    • property

      public static String property(Config config, String key, String relaxed)
      The first of the keys that is set, or null. For configuration-property binding.
    • profiles

      public static boolean profiles(Config config, String[] profiles)
      Whether any of the profiles, each optionally negated with !, is active.
    • propertyMatches

      public static boolean propertyMatches(Config config, String key, String havingValue, boolean matchIfMissing)
      @ConditionalOnProperty: whether the key's value matches.
    • produced

      public static Object produced(Object bean, String factory)
      What a @Bean method returned, refused when it is null: a factory that produces nothing is a bug in the factory, and handing the null to what injects it would only move the failure to its first use.
    • preferred

      public static Object preferred(Object[] candidates, boolean required, String what)
      The first of candidates -- a conditional @Primary -- when it exists, otherwise the one of the rest that does, as single(Object[], boolean, String) picks it.
    • single

      public static Object single(Object[] candidates, boolean required, String what)
      The one bean of candidates that exists, when all of them are conditional. More than one existing is ambiguous; none is a missing dependency when required.
    • list

      public static List list(Object[] items)
      The beans of items that exist, for a List injection point.
    • toInt

      public static int toInt(String value, String where)
    • toLong

      public static long toLong(String value, String where)
    • toShort

      public static short toShort(String value, String where)
    • toByte

      public static byte toByte(String value, String where)
    • toDouble

      public static double toDouble(String value, String where)
    • toFloat

      public static float toFloat(String value, String where)
    • toChar

      public static char toChar(String value, String where)
    • toBoolean

      public static boolean toBoolean(String value, String where)
    • toEnum

      public static Object toEnum(Object[] values, String value, String where)
      The constant of an enum by name; values is the enum's values().
    • destroyFailed

      public static void destroyFailed(String bean, Throwable error)
      Reports a destroy method that failed; the others still run.