/** when passed as a value to a ListConfigKey, causes each of these items to be added */ public static final <T> ListModification<T> addAll(final Collection<T> items) { return new ListModificationBase<T>(items, false); } /** when passed as a value to a ListConfigKey, causes the items to be added as a single element in the list */
protected Integer convertConfigToSensor(PortRange value, Entity entity) { // TODO when using JmxAgentModes.NONE we should *not* convert, but leave it null // (e.g. to prevent a warning in e.g. ActiveMQIntegrationTest) // however supporting that means moving these keys to UsesJmx (which would be a good thing in any case) return super.convertConfigToSensor(value, entity); } };
public ConfigKey<V> subKey(String subName, String description) { return new SubElementConfigKey<V>(this, subType, getName() + "." + subName, description, null); }
public static <T> ConfigKey<T> newConfigKey(TypeToken<T> type, String name) { return new BasicConfigKey<T>(type, name); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Object applyToKeyInMap(ListConfigKey<T> key, Map target) { if (clearFirst) { StructuredModification<StructuredConfigKey> clearing = StructuredModifications.clearing(); clearing.applyToKeyInMap(key, target); } for (T o: this) target.put(key.subKey(), o); return null; } }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Object applyToKeyInMap(SetConfigKey<T> key, Map target) { if (clearFirst) { StructuredModification<StructuredConfigKey> clearing = StructuredModifications.clearing(); clearing.applyToKeyInMap(key, target); } for (T o: this) target.put(key.subKey(), o); return null; } }
@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); } }
public ConfigKey<V> subKey() { String subName = Identifiers.makeRandomId(8); return new SubElementConfigKey<V>(this, subType, getName()+"."+subName, "element of "+getName()+", uid "+subName, null); }
public ConfigKey<V> subKey() { String subName = Identifiers.makeRandomId(8); return new SubElementConfigKey<V>(this, subType, getName()+"."+subName, "element of "+getName()+", uid "+subName, null); }
/** when passed as a value to a MapConfigKey, causes the map to be cleared and these items added */ public static final <V> MapModification<V> set(final Map<String,V> itemsToPutInMapAfterClearing) { return new MapModificationBase<V>(itemsToPutInMapAfterClearing, true); } /** when passed as a value to a MapConfigKey, causes the items to be added to the underlying map
/** when passed as a value to a SetConfigKey, causes each of these items to be added */ public static final <T> SetModification<T> addAll(final Collection<T> items) { return new SetModificationBase<T>(items, false); } /** when passed as a value to a SetConfigKey, causes the items to be added as a single element in the set */
@Override public <T> T getAttribute(AttributeSensor<T> attribute) { return attributesInternal.getValue(attribute); }
/** @see Sensor#newEvent(Entity, Object) */ public SensorEvent<T> newEvent(Entity producer, T value) { return new BasicSensorEvent<T>(this, producer, value); }
@Override public boolean isSet(Map<?,?> vals) { return super.isSet(vals); } }
public boolean isSubKey(Object contender) { return contender instanceof ConfigKey && isSubKey((ConfigKey<?>)contender); }
public boolean isSubKey(ConfigKey<?> contender) { return (contender instanceof SubElementConfigKey && this.equals(((SubElementConfigKey<?>) contender).parent)); }
/** when passed as a value to a MapConfigKey, causes the items to be added to the underlying map * using {@link Jsonya} add semantics (combining maps and lists) */ public static final <V> MapModification<V> add(final Map<String,V> itemsToAdd) { return new MapModificationBase<V>(itemsToAdd, false /* ignored */) { private static final long serialVersionUID = 1L; @SuppressWarnings("rawtypes") @Override public Object applyToKeyInMap(MapConfigKey<V> key, Map target) { return key.applyValueToMap(Jsonya.of(key.rawValue(target)).add(this).getRootMap(), target); } }; } }
/** when passed as a value to a ListConfigKey, causes the list to be cleared and these items added */ public static final <T> ListModification<T> set(final Collection<T> items) { return new ListModificationBase<T>(items, true); } }
/** when passed as a value to a SetConfigKey, causes the set to be cleared and these items added */ public static final <T> SetModification<T> set(final Collection<T> items) { return new SetModificationBase<T>(items, true); } }
/** when passed as a value to a MapConfigKey, causes each of these items to be put * (this Mod is redundant as no other value is really sensible) */ public static final <V> MapModification<V> put(final Map<String,V> itemsToPutInMapReplacing) { return new MapModificationBase<V>(itemsToPutInMapReplacing, false); } /** when passed as a value to a MapConfigKey, causes the map to be cleared and these items added */