/** * Returns a transformer to be applied to all operations that operate on an existing resource. * This is typically used to adapt legacy operations to conform to the current version of the model. * @return an operation handler transformer. */ default UnaryOperator<OperationStepHandler> getOperationTransformation() { return UnaryOperator.identity(); } }
/** * Constructs a new LegacyPropertyWriteOperationTransformer with no address transformation. */ public LegacyPropertyWriteOperationTransformer() { this(UnaryOperator.identity()); }
/** * Creates a new capability based on the specified requirement * @param requirement the requirement basis */ public RequirementCapability(Requirement requirement) { this(requirement, UnaryOperator.identity()); }
ProtocolRegistration(ResourceServiceConfiguratorFactory parentServiceConfiguratorFactory) { this.parentServiceConfiguratorFactory = parentServiceConfiguratorFactory; this.configurator = UnaryOperator.identity(); }
PlainAuthTokenResourceDefinition() { super(PATH, UnaryOperator.identity(), PlainAuthTokenServiceConfigurator::new); } }
@Override public Map<String, Optional<Partition>> getPartitionsByNames(String databaseName, String tableName, List<String> partitionNames) { requireNonNull(partitionNames, "partitionNames is null"); if (partitionNames.isEmpty()) { return ImmutableMap.of(); } Map<String, List<String>> partitionNameToPartitionValuesMap = partitionNames.stream() .collect(Collectors.toMap(identity(), HiveUtil::toPartitionValues)); Map<List<String>, Partition> partitionValuesToPartitionMap = delegate.getPartitionsByNames(databaseName, tableName, partitionNames).stream() .map(ThriftMetastoreUtil::fromMetastoreApiPartition) .collect(Collectors.toMap(Partition::getValues, identity())); ImmutableMap.Builder<String, Optional<Partition>> resultBuilder = ImmutableMap.builder(); for (Map.Entry<String, List<String>> entry : partitionNameToPartitionValuesMap.entrySet()) { Partition partition = partitionValuesToPartitionMap.get(entry.getValue()); resultBuilder.put(entry.getKey(), Optional.ofNullable(partition)); } return resultBuilder.build(); }
/** * Create the mechanism instance. * * @param name the mechanism name (must not be {@code null}) * @return the mechanism, or {@code null} if the mechanism with the given name is not supported * @throws E if the mechanism instantiation failed */ default M createMechanism(String name) throws E { return createMechanism(name, UnaryOperator.identity()); }
/** * Create a SASL client using the given URI and configuration from the given SASL client factory. * * @param uri the target URI (must not be {@code null}) * @param configuration the authentication configuration (must not be {@code null}) * @param offeredMechanisms the available mechanisms (must not be {@code null}) * @return the SASL client, or {@code null} if no clients were available or could be configured */ public SaslClient createSaslClient(URI uri, AuthenticationConfiguration configuration, Collection<String> offeredMechanisms) throws SaslException { return createSaslClient(uri, configuration, offeredMechanisms, UnaryOperator.identity()); }
RandomElectionPolicyResourceDefinition() { super(PATH, SingletonExtension.SUBSYSTEM_RESOLVER.createChildResolver(PATH, WILDCARD_PATH), UnaryOperator.identity(), RandomElectionPolicyServiceConfigurator::new); } }
InvalidationCacheResourceDefinition() { super(WILDCARD_PATH, UnaryOperator.identity(), new ClusteredCacheServiceHandler(InvalidationCacheServiceConfigurator::new)); } }
/** * <pre> * Ex: Partition keys = ['a', 'b'] * Partition names = ['a=1/b=2', 'a=2/b=2'] * </pre> * * @param partitionNames List of full partition names * @return Mapping of partition name to partition object */ @Override public Map<String, Optional<Partition>> getPartitionsByNames(String databaseName, String tableName, List<String> partitionNames) { requireNonNull(partitionNames, "partitionNames is null"); if (partitionNames.isEmpty()) { return ImmutableMap.of(); } List<Partition> partitions = batchGetPartition(databaseName, tableName, partitionNames); Map<String, List<String>> partitionNameToPartitionValuesMap = partitionNames.stream() .collect(toMap(identity(), HiveUtil::toPartitionValues)); Map<List<String>, Partition> partitionValuesToPartitionMap = partitions.stream() .collect(toMap(Partition::getValues, identity())); ImmutableMap.Builder<String, Optional<Partition>> resultBuilder = ImmutableMap.builder(); for (Entry<String, List<String>> entry : partitionNameToPartitionValuesMap.entrySet()) { Partition partition = partitionValuesToPartitionMap.get(entry.getValue()); resultBuilder.put(entry.getKey(), Optional.ofNullable(partition)); } return resultBuilder.build(); }
NoTransportResourceDefinition() { super(PATH, UnaryOperator.identity(), new NoTransportServiceHandler()); } }
ReplicatedCacheResourceDefinition() { super(WILDCARD_PATH, UnaryOperator.identity(), new ClusteredCacheServiceHandler(ReplicatedCacheServiceConfigurator::new)); } }
LocalCacheResourceDefinition() { super(WILDCARD_PATH, UnaryOperator.identity(), new LocalCacheServiceHandler()); } }
/** * Creates a new gRPC interceptor that will collect metrics into the given {@link MeterRegistry}. This method won't * use any customizers and will only initialize the {@link Code#OK OK} status. * * @param registry The registry to use. */ public AbstractMetricCollectingInterceptor(final MeterRegistry registry) { this(registry, UnaryOperator.identity(), UnaryOperator.identity(), Code.OK); }
/** * Override this if your key type is mutable and subject to change. * * @return a function that used to copy the counter object. This function is only used when the * collector has never seen the counter object before. In this case the collector needs to * possibly copy the counter object before using as map key. The default implementation is * the {@link UnaryOperator#identity()} function. */ protected UnaryOperator<K> copier() { return UnaryOperator.identity(); }
private Map<String, AuditLogChange> changeToMap(Set<AuditLogChange> changesList) { return changesList.stream().collect(Collectors.toMap(AuditLogChange::getKey, UnaryOperator.identity())); }
/** Returns a File (in a temporary folder) which has the contents of the given file from the src/test/resources directory. */ protected File createTestFile(String filename) throws IOException { return createTestFile(filename, UnaryOperator.identity()); }
public static <T> void assertFutureFirstEquals(final T expected, final StreamRecorder<T> responseObserver, final int timeout, final TimeUnit timeoutUnit) { assertFutureFirstEquals(expected, responseObserver, UnaryOperator.identity(), timeout, timeoutUnit); }