@Override public EnricherType getSnapshot() { return (EnricherType) super.getSnapshot(); }
/** field where a config key is defined, for use getting annotations. note annotations are not inherited. */ public Field getConfigKeyField(String keyName) { return field(configKeys.get(keyName)); }
/** * @deprecated since 0.7; unused code; instead use {@link #getBrooklynClass()} */ @Deprecated public Class<? extends Entity> getEntityClass() { return super.getBrooklynClass(); }
public static Map<String,Object> toItemDescriptor(Class<? extends BrooklynObject> clazz, boolean headingsOnly) { BrooklynDynamicType<?, ?> dynamicType = BrooklynTypes.getDefinedBrooklynType(clazz); BrooklynType type = dynamicType.getSnapshot(); ConfigKey<?> version = dynamicType.getConfigKey(BrooklynConfigKeys.SUGGESTED_VERSION.getName()); config.add(EntityTransformer.entityConfigSummary(x, dynamicType.getConfigKeyField(x.getName())));
static List<SpecParameter<?>> collectParameters(Class<?> c) { MutableList<WeightedParameter> parameters = MutableList.<WeightedParameter>of(); if (BrooklynObject.class.isAssignableFrom(c)) { @SuppressWarnings("unchecked") Class<? extends BrooklynObject> brooklynClass = (Class<? extends BrooklynObject>) c; BrooklynDynamicType<?, ?> dynamicType = BrooklynTypes.getDefinedBrooklynType(brooklynClass); BrooklynType type = dynamicType.getSnapshot(); for (ConfigKey<?> x: type.getConfigKeys()) { WeightedParameter fieldConfig = getFieldConfig(x, dynamicType.getConfigKeyField(x.getName())); parameters.appendIfNotNull(fieldConfig); } Collections.sort(parameters, new WeightedParameterComparator()); return FluentIterable.from(parameters) .transform(new SpecParameterTransformer()).toList(); } else { return ImmutableList.of(); } }
public synchronized BrooklynType getSnapshot() { return refreshSnapshot(); }
protected BrooklynTypeSnapshot refreshSnapshot() { if (snapshotValid.compareAndSet(false, true)) { snapshot = newSnapshot(); } return snapshot; }
protected BrooklynDynamicType(Class<? extends T> clazz, AbstractT instance) { this.brooklynClass = checkNotNull(clazz, "brooklyn class"); this.instance = instance; // NB: official name is usually injected later, e.g. from AbstractEntity.setManagementContext this.name = (clazz.getCanonicalName() == null) ? clazz.getName() : clazz.getCanonicalName(); buildConfigKeys(clazz, null, configKeys); if (LOG.isTraceEnabled()) LOG.trace("Entity {} config keys: {}", (instance==null ? clazz.getName() : instance.getId()), Joiner.on(", ").join(configKeys.keySet())); }
public void setName(String name) { if (Strings.isBlank(name)) { throw new IllegalArgumentException("Invalid name "+(name == null ? "null" : "'"+name+"'")+"; name must be non-empty and not just white space"); } this.name = name; invalidateSnapshot(); }
public static Map<String, ConfigKey<?>> getDefinedConfigKeys(Class<? extends BrooklynObject> brooklynClass) { return getDefinedBrooklynType(brooklynClass).getConfigKeys(); }
@Override public LocationType getSnapshot() { return (LocationType) super.getSnapshot(); }
@Override public EntityType getSnapshot() { return (EntityType) super.getSnapshot(); }
@Override public PolicyType getSnapshot() { return (PolicyType) super.getSnapshot(); }