Tabnine Logo
MapConfigKey
Code IndexAdd Tabnine to your IDE (free)

How to use
MapConfigKey
in
brooklyn.event.basic

Best Java code snippets using brooklyn.event.basic.MapConfigKey (Showing top 17 results out of 315)

origin: io.brooklyn/brooklyn-software-base

public static ConfigKey<String> javaSysProp(String propertyName) { return UsesJava.JAVA_SYSPROPS.subKey(propertyName); }

origin: io.brooklyn/brooklyn-core

public boolean isSubKey(ConfigKey<?> contender) {
  return (contender instanceof SubElementConfigKey && this.equals(((SubElementConfigKey<?>) contender).parent));
}
origin: io.brooklyn/brooklyn-core

public ConfigKey<V> subKey(String subName) {
  return subKey(subName, "sub-element of " + getName() + ", named " + subName);
}
// it is not possible to supply default values
origin: io.brooklyn/brooklyn-core

@SuppressWarnings({ "rawtypes", "unchecked" })
protected Object applyEntryValueToMap(Entry value, Map target) {
  Object k = value.getKey();
  if (isSubKey(k)) {
    // do nothing
  } else if (k instanceof String) {
    k = subKey((String)k);
  } else {
    log.warn("Unexpected subkey "+k+" being inserted into "+this+"; ignoring");
    k = null;
  }
  if (k!=null)
    return target.put(k, value.getValue());
  else 
    return null;
}
origin: io.brooklyn/brooklyn-core

/** returns the entries in the map against this config key and any sub-config-keys, without resolving
 * (like {@link #extractValue(Map, ExecutionContext)} but without resolving/coercing;
 * useful because values in this "map" are actually stored against {@link SubElementConfigKey}s */
public Map<String,Object> rawValue(Map<?,?> vals) {
  Map<String,Object> result = Maps.newLinkedHashMap();
  for (Map.Entry<?,?> entry : vals.entrySet()) {
    Object k = entry.getKey();
    if (isSubKey(k)) {
      @SuppressWarnings("unchecked")
      SubElementConfigKey<V> subk = (SubElementConfigKey<V>) k;
      result.put(extractSubKeyName(subk), vals.get(subk));
    }
  }
  return result;
}
origin: io.brooklyn/brooklyn-core

  @SuppressWarnings("rawtypes")
  @Override
  public Object applyToKeyInMap(MapConfigKey<V> key, Map target) {
    return key.applyValueToMap(Jsonya.of(key.rawValue(target)).add(this).getRootMap(), target);
  }
};
origin: io.brooklyn/brooklyn-core

public String extractSubKeyName(ConfigKey<?> subKey) {
  return subKey.getName().substring(getName().length() + 1);
}
origin: io.brooklyn/brooklyn-core

public boolean isSubKey(Object contender) {
  return contender instanceof ConfigKey && isSubKey((ConfigKey<?>)contender);
}

origin: io.brooklyn/brooklyn-core

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Object applyValueToMap(Object value, Map target) {
  if (value == null)
    return null;
  if (value instanceof StructuredModification)
    return ((StructuredModification)value).applyToKeyInMap(this, target);
  if (value instanceof Map.Entry)
    return applyEntryValueToMap((Map.Entry)value, target);
  if (!(value instanceof Map)) 
    throw new IllegalArgumentException("Cannot set non-map entries "+value+" on "+this);
  
  Map result = new MutableMap();
  for (Object entry: ((Map)value).entrySet()) {
    Map.Entry entryT = (Map.Entry)entry;
    result.put(entryT.getKey(), applyEntryValueToMap(entryT, target));
  }
  return result;
}
origin: io.brooklyn/brooklyn-core

  @SuppressWarnings({ "rawtypes" })
  @Override
  public Object applyToKeyInMap(MapConfigKey<V> key, Map target) {
    if (clearFirst) {
      StructuredModification<StructuredConfigKey> clearing = StructuredModifications.clearing();
      clearing.applyToKeyInMap(key, target);
    }
    return key.applyValueToMap(new LinkedHashMap<String,V>(this), target);
  }
}
origin: io.brooklyn/brooklyn-core

@Override
public Map<String,V> extractValue(Map<?,?> vals, ExecutionContext exec) {
  Map<String,V> result = Maps.newLinkedHashMap();
  for (Map.Entry<?,?> entry : vals.entrySet()) {
    Object k = entry.getKey();
    if (isSubKey(k)) {
      @SuppressWarnings("unchecked")
      SubElementConfigKey<V> subk = (SubElementConfigKey<V>) k;
      result.put(extractSubKeyName(subk), (V) subk.extractValue(vals, exec));
    }
  }
  return Collections.unmodifiableMap(result);
}
/** returns the entries in the map against this config key and any sub-config-keys, without resolving
origin: io.brooklyn/brooklyn-core

public ConfigKey<V> subKey(String subName, String description) {
  return new SubElementConfigKey<V>(this, subType, getName() + "." + subName, description, null);
}
origin: io.brooklyn/brooklyn-core

@Override
public boolean isSet(Map<?, ?> vals) {
  if (vals.containsKey(this))
    return true;
  for (Object contender : vals.keySet()) {
    if (isSubKey(contender)) {
      return true;
    }
  }
  return false;
}

origin: io.brooklyn/brooklyn-software-base

/** replaces the attributes underneath the rootAttribute parameter with the given value;
 * see {@link #addLaunchAttributesMap(EntitySpec, Map)} for richer functionality */
public static void setLaunchAttribute(EntityInternal entity, String rootAttribute, Object value) {
  entity.setConfig(ChefSoloDriver.CHEF_LAUNCH_ATTRIBUTES.subKey(rootAttribute), value);
}
origin: io.brooklyn/brooklyn-software-base

public static void addToCookbooksFromGithub(EntitySpec<?> entity, String cookbookName, String cookbookUrl) {
  entity.configure(ChefSoloDriver.CHEF_COOKBOOKS.subKey(cookbookName), cookbookUrl);
}
origin: io.brooklyn/brooklyn-software-base

/** replaces the attributes underneath the rootAttribute parameter with the given value;
 * see {@link #addLaunchAttributesMap(EntitySpec, Map)} for richer functionality */
public static void setLaunchAttribute(EntitySpec<?> entity, String rootAttribute, Object value) {
  entity.configure(ChefSoloDriver.CHEF_LAUNCH_ATTRIBUTES.subKey(rootAttribute), value);
}

origin: io.brooklyn/brooklyn-software-base

public static void addToCookbooksFromGithub(EntityInternal entity, String cookbookName, String cookbookUrl) {
  entity.setConfig(ChefSoloDriver.CHEF_COOKBOOKS.subKey(cookbookName), cookbookUrl);
}
brooklyn.event.basicMapConfigKey

Javadoc

A config key which represents a map, where contents can be accessed directly via subkeys. Items added directly to the map must be of type map, and are put (as individual subkeys).

You can also pass an appropriate MapModification from MapModificationsto clear (and clear-and-set).

Most used methods

  • subKey
  • applyEntryValueToMap
  • applyValueToMap
  • equals
  • extractSubKeyName
  • getName
  • isSubKey
  • rawValue
    returns the entries in the map against this config key and any sub-config-keys, without resolving (l

Popular in Java

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Notification (javax.management)
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now