Add common interface for function constants

This commit is contained in:
Oleg Zhurakousky
2019-09-30 11:32:03 -04:00
parent ba49a81474
commit 84f29c51a3
2 changed files with 55 additions and 8 deletions

View File

@@ -41,8 +41,6 @@ import org.springframework.util.CollectionUtils;
*/
class BindableFunctionProxyFactory extends BindableProxyFactory {
static final String delimiter = "-";
private final int inputCount;
private final int outputCount;
@@ -128,18 +126,18 @@ class BindableFunctionProxyFactory extends BindableProxyFactory {
private String buildInputNameForIndex(int index) {
return new StringBuilder(this.functionDefinition)
.append(delimiter)
.append("in")
.append(delimiter)
.append(FunctionConstants.DELIMITER)
.append(FunctionConstants.DEFAULT_INPUT_SUFFIX)
.append(FunctionConstants.DELIMITER)
.append(index)
.toString();
}
private String buildOutputNameForIndex(int index) {
return new StringBuilder(this.functionDefinition)
.append(delimiter)
.append("out")
.append(delimiter)
.append(FunctionConstants.DELIMITER)
.append(FunctionConstants.DEFAULT_OUTPUT_SUFFIX)
.append(FunctionConstants.DELIMITER)
.append(index)
.toString();
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright 2019-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.stream.function;
/**
* Interfaces which defines constants used for naming conventions used in bindings
* of multiple functions or functions with multiple inputs and outputs.
*
* @author Oleg Zhurakousky
* @author Soby Chacko
*
* @since 3.0
*
*/
public final class FunctionConstants {
private FunctionConstants() {
}
/**
* Delimiter used for functional binding naming convention.
*/
public static final String DELIMITER = "-";
/**
* Suffix used for functional binding naming convention.
*/
public static final String DEFAULT_OUTPUT_SUFFIX = "out";
/**
* Prefix used for functional binding naming convention.
*/
public static final String DEFAULT_INPUT_SUFFIX = "in";
}