提交 a1c634b6 编写于 作者: B Bogdan Kobylynskyi

Fix javadoc and suppress false-positive sonar warnings

上级 6a457bdb
...@@ -39,13 +39,20 @@ public class ValueMapper { ...@@ -39,13 +39,20 @@ public class ValueMapper {
return value.isValue() ? "true" : "false"; return value.isValue() ? "true" : "false";
} }
//TODO It should also be abstracted. Different languages have different default values(It is now implemented in /**
// templates (templates are extremely complex)) * Map value of GraphQL Int type to a value that will be present in a generated code.
* TODO: should also be abstracted because different languages have different default values
*
* @param mappingContext Global mapping context
* @param value GraphQL Value
* @param graphQLType GraphQL Type
* @return formatted value
*/
private static String mapInt(MappingContext mappingContext, IntValue value, Type<?> graphQLType) { private static String mapInt(MappingContext mappingContext, IntValue value, Type<?> graphQLType) {
//default java basic type is `int`. so, default value like 123 that must wrap or append suffix `L` when it be // default java basic type is `int`. so, default value like 123 that must wrap or append suffix `L` when it be
// defined as `int` in graphql schema. // defined as `int` in graphql schema.
//`int` cannot assign to `Long`, also `double` cannot assign to `Float`, but graphql Float default mapping is // `int` cannot assign to `Long`, also `double` cannot assign to `Float`, but graphql Float default mapping is
// Double in java, so, not modify `mapFloat`. // Double in java, so, not modify `mapFloat`.
if (graphQLType instanceof TypeName) { if (graphQLType instanceof TypeName) {
String customType = mappingContext.getCustomTypesMapping().get("Long"); String customType = mappingContext.getCustomTypesMapping().get("Long");
String typeName = ((TypeName) graphQLType).getName(); String typeName = ((TypeName) graphQLType).getName();
......
...@@ -24,6 +24,7 @@ public class MultiLanguageDeprecated { ...@@ -24,6 +24,7 @@ public class MultiLanguageDeprecated {
* @param directive GraphQL @deprecated directive * @param directive GraphQL @deprecated directive
* @return a definition of a deprecation having reason and annotation * @return a definition of a deprecation having reason and annotation
*/ */
@SuppressWarnings({"java:S1133", "java:S1123"}) // sonar treats this is a deprecated method
public static DeprecatedDefinition getLanguageDeprecated(GeneratedLanguage generatedLanguage, Directive directive) { public static DeprecatedDefinition getLanguageDeprecated(GeneratedLanguage generatedLanguage, Directive directive) {
String msg = null; String msg = null;
if (directive.getArguments().stream().anyMatch(argument -> argument.getName().equals(REASON))) { if (directive.getArguments().stream().anyMatch(argument -> argument.getName().equals(REASON))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册