@SuppressWarnings("unchecked") public BasicSensor(TypeToken<T> typeToken, String name, String description) { this((Class<T>)TypeTokens.getRawTypeIfRaw(typeToken), TypeTokens.getTypeTokenIfNotRaw(checkNotNull(typeToken, "typeToken")), checkNotNull(name, "name"), description); }
@SuppressWarnings("unchecked") public Builder(String newName, ConfigKey<T> key) { TypeToken<T> tt = key.getTypeToken(); this.type = (Class<T>) TypeTokens.getRawTypeIfRaw(tt); this.typeToken = TypeTokens.getTypeTokenIfNotRaw(tt); this.name = checkNotNull(newName, "name"); this.deprecatedNames = checkNotNull(key.getDeprecatedNames(), "deprecatedNames"); description(key.getDescription()); defaultValue(key.getDefaultValue()); reconfigurable(key.isReconfigurable()); runtimeInheritance(key.getInheritanceByContext(InheritanceContext.RUNTIME_MANAGEMENT)); typeInheritance(key.getInheritanceByContext(InheritanceContext.TYPE_DEFINITION)); constraint(key.getConstraint()); } public B name(String val) {