Codota Logo
FlagUtils$FlagConfigKeyAndValueRecord
Code IndexAdd Codota to your IDE (free)

How to use
FlagUtils$FlagConfigKeyAndValueRecord
in
org.apache.brooklyn.util.core.flags

Best Java code snippets using org.apache.brooklyn.util.core.flags.FlagUtils$FlagConfigKeyAndValueRecord (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: org.apache.brooklyn/brooklyn-core

protected boolean isRecordEqual(FlagConfigKeyAndValueRecord val1, ExpectedFlagConfigKeyAndValueRecord val2) {
  return Objects.equal(val1.getConfigKey(), val2.configKey)
      && Objects.equal(val1.getFlagName(), val2.flagName)
      && Objects.equal(val1.getConfigKeyMaybeValue(), val2.configKeyValue)
      && Objects.equal(val1.getFlagMaybeValue(), val2.flagValue);
}
origin: org.apache.brooklyn/brooklyn-core

/** gets all the keys in the given config bag which are applicable to the given list of parameters */
public static List<FlagConfigKeyAndValueRecord> findAllParameterConfigKeys(List<SpecParameter<?>> parameters, ConfigBag input) {
  List<FlagConfigKeyAndValueRecord> output = new ArrayList<FlagUtils.FlagConfigKeyAndValueRecord>();
  for (SpecParameter<?> param : parameters) {
    FlagConfigKeyAndValueRecord record = getFlagConfigKeyRecord(null, param.getConfigKey(), input);
    if (record.isValuePresent())
      output.add(record);
  }
  return output;
}
origin: org.apache.brooklyn/brooklyn-core

/** sets _all_ accessible _{@link ConfigKey}_ and {@link HasConfigKey} fields on the given object, 
 * using the indicated flags/config-bag */
public static void setAllConfigKeys(Configurable o, ConfigBag bag, boolean includeFlags) {
  for (Field f: getAllFields(o.getClass())) {
    ConfigKey<?> key = getFieldAsConfigKey(o, f);
    if (key!=null) {
      FlagConfigKeyAndValueRecord record = getFlagConfigKeyRecord(f, key, bag);
      if ((includeFlags && record.isValuePresent()) || record.getConfigKeyMaybeValue().isPresent()) {
        setField(o, f, record.getValueOrNullPreferringConfigKey(), null);
      }
    }
  }
}

origin: org.apache.brooklyn/brooklyn-core

public Object getValueOrNullPreferringFlag() {
  return getFlagMaybeValue().or(getConfigKeyMaybeValue()).orNull();
}
/** true if value is present for either flag or config key */
origin: io.cloudsoft.brooklyn.tosca/brooklyn-tosca-transformer

private void configureWithResolvedConfigKey(FlagUtils.FlagConfigKeyAndValueRecord r, EntitySpec spec, Set<String> keyNamesUsed){
  try {
    Optional<Object> resolvedValue = resolveValue(r.getConfigKeyMaybeValue().get(), Optional.<TypeToken>of(r.getConfigKey().getTypeToken()));
    if (resolvedValue.isPresent()) {
      spec.configure(r.getConfigKey(), resolvedValue.get());
    }
    // todo: Should this be in the if block?
    keyNamesUsed.add(r.getConfigKey().getName());
  } catch (Exception e) {
    String message = String.format("Cannot set config key %s, could not coerce %s to %s",
        r.getConfigKey(), r.getConfigKeyMaybeValue(), r.getConfigKey().getTypeToken());
    LOG.warn(message, e);
  }
}
origin: io.cloudsoft.brooklyn.tosca/brooklyn-tosca-transformer

private void configureWithResolvedFlag(FlagUtils.FlagConfigKeyAndValueRecord r, EntitySpec spec, Set<String> keyNamesUsed){
  Optional<Object> resolvedValue = resolveValue(r.getFlagMaybeValue().get(), Optional.<TypeToken>absent());
  if (resolvedValue.isPresent()) {
    spec.configure(r.getFlagName(), resolvedValue.get());
  }
  keyNamesUsed.add(r.getFlagName());
}
origin: io.cloudsoft.brooklyn.tosca/brooklyn-tosca-transformer

private void configureWithAllRecords(Collection<FlagUtils.FlagConfigKeyAndValueRecord> records, EntitySpec spec, Set<String> keyNamesUsed){
  for (FlagUtils.FlagConfigKeyAndValueRecord r : records) {
    if (r.getFlagMaybeValue().isPresent()) {
      configureWithResolvedFlag(r, spec, keyNamesUsed);
    }
    if (r.getConfigKeyMaybeValue().isPresent()) {
      configureWithResolvedConfigKey(r, spec, keyNamesUsed);
    }
  }
}
origin: org.apache.brooklyn/brooklyn-core

/** gets all the flags/keys in the given config bag which are applicable to the given type's config keys and flags */
public static <T> List<FlagConfigKeyAndValueRecord> findAllFlagsAndConfigKeys(T optionalInstance, Class<? extends T> type, ConfigBag input) {
  List<FlagConfigKeyAndValueRecord> output = new ArrayList<FlagUtils.FlagConfigKeyAndValueRecord>();
  for (Field f: getAllFields(type)) {
    ConfigKey<?> key = getFieldAsConfigKey(optionalInstance, f);
    FlagConfigKeyAndValueRecord record = getFlagConfigKeyRecord(f, key, input);
    if (record.isValuePresent())
      output.add(record);
  }
  return output;
}
origin: org.apache.brooklyn/brooklyn-core

public Object getValueOrNullPreferringConfigKey() {
  return getConfigKeyMaybeValue().or(getFlagMaybeValue()).orNull();
}
public Object getValueOrNullPreferringFlag() {
origin: org.apache.brooklyn/brooklyn-core

/** returns the flag/config-key record for the given input */
private static FlagConfigKeyAndValueRecord getFlagConfigKeyRecord(Field f, ConfigKey<?> key, ConfigBag input) {
  FlagConfigKeyAndValueRecord result = new FlagConfigKeyAndValueRecord(); 
  result.configKey = key;
  if (key!=null && input.containsKey(key))
    result.configKeyValue = input.getObjKeyMaybe(key);
  if (f != null) {
    SetFromFlag flag = f.getAnnotation(SetFromFlag.class);
    if (flag!=null) {
      String flagName = elvis(flag.value(), f.getName());
      result.flagName = flagName;
      if (input.containsKey(flagName))
        result.flagValue = Maybe.of(input.getStringKey(flagName));
    }
  }
  return result;
}
org.apache.brooklyn.util.core.flagsFlagUtils$FlagConfigKeyAndValueRecord

Most used methods

  • getConfigKeyMaybeValue
  • getFlagMaybeValue
  • getConfigKey
  • getFlagName
  • <init>
  • getValueOrNullPreferringConfigKey
  • isValuePresent
    true if value is present for either flag or config key

Popular in Java

  • Updating database using SQL prepared statement
  • findViewById (Activity)
  • getSystemService (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Join (org.hibernate.mapping)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now