Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion component-server-parent/component-server-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/**
* Copyright (C) 2006-2025 Talend Inc. - www.talend.com
*
* 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
*
* http://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.talend.sdk.component.server.front.model;

import java.beans.ConstructorProperties;
import java.util.LinkedHashMap;
import java.util.Map;

import lombok.Data;

@Data
public final class Entry {

private final String name;

private final String rawName;

private final Schema.Type type;

private final boolean nullable;

private final boolean metadata;

private final boolean errorCapable;

private final boolean valid;

private final Schema elementSchema;

private final String comment;

private final Map<String, String> props = new LinkedHashMap<>(0);

private final Object defaultValue;

@ConstructorProperties({ "name", "rawName", "type", "nullable", "metadata", "errorCapable",
"valid", "elementSchema", "comment", "props", "defaultValue" })
// Checkstyle off to let have 11 parameters to this constructor (normally 10 max)
// CHECKSTYLE:OFF
public Entry(

Check warning on line 53 in component-server-parent/component-server-model/src/main/java/org/talend/sdk/component/server/front/model/Entry.java

View check run for this annotation

sonar-eks / SonarQube Code Analysis

component-server-parent/component-server-model/src/main/java/org/talend/sdk/component/server/front/model/Entry.java#L53

Constructor has 11 parameters, which is greater than 7 authorized.
final String name,
final String rawName,
final Schema.Type type,
final boolean nullable,
final boolean metadata,
final boolean errorCapable,
final boolean valid,
final Schema elementSchema,
final String comment,
final Map<String, String> props,
final Object defaultValue) {
// CHECKSTYLE:ON
this.name = name;
this.rawName = rawName;
this.type = type;
this.nullable = nullable;
this.metadata = metadata;
this.errorCapable = errorCapable;
this.valid = valid;
this.elementSchema = elementSchema;
this.comment = comment;
this.props.putAll(props);
this.defaultValue = defaultValue;
}

private Object getInternalDefaultValue() {
return defaultValue;
}

@SuppressWarnings("unchecked")
public <T> T getDefaultValue() {
if (defaultValue == null) {
return null;
}

return switch (this.getType()) {
case INT -> (T) ((Integer) ((Number) this.getInternalDefaultValue()).intValue());
case LONG -> (T) ((Long) ((Number) this.getInternalDefaultValue()).longValue());
case FLOAT -> (T) ((Float) ((Number) this.getInternalDefaultValue()).floatValue());
case DOUBLE -> (T) ((Double) ((Number) this.getInternalDefaultValue()).doubleValue());
default -> (T) this.getInternalDefaultValue();
};

}

public String getOriginalFieldName() {
return rawName != null ? rawName : name;
}

public String getProp(final String key) {
return this.props.get(key);
}

}

This file was deleted.

This file was deleted.

Loading
Loading