Dockerfile
containing the docker build instructions for that module.@Service
. This will be in the core-module. This will be under *.spi.xyz.service
package.@Service
. This should not be defined in a core-module. It will be defined in a common
or service
module. This will be under *.spi.xyz.service.impl
package.*.xyz.dto
package.*.xyz.dto
package.*.xyz.entity
or *.xyz.dao
package.io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository
. This will be annotated with @Repository annotation. This will be under *.xyz.repository
package.*.xyz.controller
package.*.xyz.config
package.*.xyz.util
package.*.xyz.helper
package.*.xyz.constant
package.io.mosip.kernel.core.exception.BaseCheckedException
and io.mosip.kernel.core.exception.BaseUncheckedException
. This will be defined in a core-module. This will be under *.xyz.exception
package.@ControllerAdvice
or @RestControllerAdvice
annotation. This will be under *.xyz.exception
package.*.xyz.factory
package.*.xyz.builder
package.@Component
. A component may or may not be implementing an interface.io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository
.MOSIP public key
."errors"
attribute."error"
attribute should under "errors"
should have "errorCode"
, "errorMessage
" and an optional "actionMessage"
. * For any service, possible "errorCode"
, "errorMessage"
and the optional "actionMessage"
should be properly listed documented in its API specification."id
, "version"
and "requestTime"
/"responseTime"
, etc... .if-else if-else
conditions can have their descriptions about their various conditional expressions./** COMMENT */
List
instead of ArrayList
.return new String[0]
.Collections.emptySet()
, Collections.emptyList()
or Collections.emptyMap()
;List
instead of ArrayList
.Optional
return type to avoid null checking. When there is possible to return null
for a method, return Optional.empty()
.OptionalInt
, OptionalLong
return types for a method when there is an unknown value of Integer/Long to be returned like -1
;true
or false
for the condition. For example,/* falls through */
comment.default
case. The break in the default case is redundant, but it prevents a fall-through error if later another case is added.private
, default or protected
. Avoid giving public
access to them unless it is really required. Avoid using public non-final fields in a Class.int
, boolean
and long
over their Boxed counterparts such as Integer
, Boolean
and Long
.List
instead of ArrayList
.Optional
return type in a method to avoid null checking. When there is possible to return null
for a method, return Optional.empty()
.OptionalInt
or OptionalLong
return type in a method when there is an unknown value of Integer/Long to be returned like -1
;Optional
using Optional.get()
without checking for Optional.isPresent()
condition, otherwise use Optional.orElse()
.OptionalInt
or OptionalLong
over Optional<Integer>
or Optional<Long>
.java.util.function
package, satisfy most developers' needs in providing target types for lambda expressions and method references.@FunctionalInterface
annotation. This is not only for the documentation purpose but also to avoid accidentally breaking the Functional Interface behavior.Collection.forEach()
or Stream.forEach()
, use Stream.collect()
instead. For example use Stream.collect(Collectors.toList())
instead of mutating a list for collecting elements to a list.io.mosip.kernel.core.exception.BaseCheckedException
and io.mosip.kernel.core.exception.BaseUncheckedException
.java.sql.Statement
object:@ControllerAdvice
or @RestControllerAdvice
"errors"
attribute.private static Logger mosipLogger = XYZLogger.getLogger(MyClass.class);
error
, debug
or info
with appropriate parameters passed to it.