Enum MethodConvention

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<MethodConvention>

    public enum MethodConvention
    extends java.lang.Enum<MethodConvention>

    Represents the built in conventions for mapping a method name to an HTTP Method and URI.

    Since:
    1.0
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      DELETE
      The default delete method of controllers.
      HEAD
      The default head method of controllers.
      INDEX
      The index method of controllers.
      OPTIONS
      The default options method of controllers.
      SAVE
      The show method of controllers.
      SHOW
      The show method of controllers.
      TRACE
      The default trace method of controllers.
      UPDATE
      The default update method of controllers.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ID_PATH
      Path for the id.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Optional<MethodConvention> forMethod​(java.lang.String name)
      Obtain the method convention for the given method.
      java.lang.String httpMethod()  
      java.lang.String methodName()  
      java.lang.String uri()  
      static MethodConvention valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static MethodConvention[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • INDEX

        public static final MethodConvention INDEX
        The index method of controllers.
      • SHOW

        public static final MethodConvention SHOW
        The show method of controllers.
      • SAVE

        public static final MethodConvention SAVE
        The show method of controllers.
      • UPDATE

        public static final MethodConvention UPDATE
        The default update method of controllers.
      • DELETE

        public static final MethodConvention DELETE
        The default delete method of controllers.
      • OPTIONS

        public static final MethodConvention OPTIONS
        The default options method of controllers.
      • HEAD

        public static final MethodConvention HEAD
        The default head method of controllers.
      • TRACE

        public static final MethodConvention TRACE
        The default trace method of controllers.
    • Field Detail

    • Method Detail

      • values

        public static MethodConvention[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MethodConvention c : MethodConvention.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MethodConvention valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • uri

        public java.lang.String uri()
        Returns:
        The default URI to map to if non is specified
      • httpMethod

        public java.lang.String httpMethod()
        Returns:
        The HTTP method name for this convention.
      • methodName

        public java.lang.String methodName()
        Returns:
        The method name for this convention
      • forMethod

        public static java.util.Optional<MethodConvention> forMethod​(java.lang.String name)
        Obtain the method convention for the given method.
        Parameters:
        name - The method name
        Returns:
        An optional of the method convention