Class LambdaParameter


  • public final class LambdaParameter
    extends Object
    A lambda parameter with a name, a type, and whether the type is implicit in source.
    • Constructor Detail

      • LambdaParameter

        public LambdaParameter​(String name,
                               SourceType type,
                               boolean implicitType)
        Creates a lambda parameter.
        Parameters:
        name - the parameter name
        type - the parameter type, may be null
        implicitType - true if the type is omitted in source
    • Method Detail

      • explicit

        public static LambdaParameter explicit​(SourceType type,
                                               String name)
        Creates an explicitly typed parameter.
        Parameters:
        type - the declared parameter type
        name - the parameter name
        Returns:
        the new parameter
      • implicit

        public static LambdaParameter implicit​(String name,
                                               SourceType inferredType)
        Creates an implicitly typed parameter.
        Parameters:
        name - the parameter name
        inferredType - the inferred parameter type
        Returns:
        the new parameter
      • toJavaSource

        public String toJavaSource()
        Returns:
        the parameter as source text, with the type prefixed only when explicit
      • name

        public String name()
        Returns:
        the parameter name
      • type

        public SourceType type()
        Returns:
        the parameter type, may be null
      • implicitType

        public boolean implicitType()
        Returns:
        true if the type is omitted in source
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object