java.lang.Object
org.mule.runtime.api.util.NameUtils
org.mule.runtime.extension.api.util.NameUtils

public class NameUtils extends org.mule.runtime.api.util.NameUtils
Extends NameUtils with extensions oriented behavior
Since:
1.0
  • Field Details

  • Method Details

    • pluralize

      public static String pluralize(String word)
      Return the pluralized version of a word.
      Parameters:
      word - The word
      Returns:
      The pluralized word
    • pluralize

      public static String pluralize(String word, boolean considerUncountable)
      Return the pluralized version of a word.
      Parameters:
      word - The word
      considerUncountable - if it should consider that the word may be uncountable
      Returns:
      The pluralized word
    • singularize

      public static String singularize(String word)
      Return the singularized version of a word.
      Parameters:
      word - The word
      Returns:
      The singularized word
    • singularize

      public static String singularize(String word, boolean considerUncountable)
      Return the singularized version of a word.
      Parameters:
      word - The word
      considerUncountable - if it should consider that the word may be uncountable
      Returns:
      The singularized word
    • itemize

      public static String itemize(String word)
      Return the itemized version of a word, which is an {@link this#hyphenize hyphenized} version of the word with the item suffix
      Parameters:
      word - The word
      Returns:
      The singularized word
    • isUncountable

      public static boolean isUncountable(String word)
      Return true if the word is uncountable.
      Parameters:
      word - The word
      Returns:
      True if it is uncountable
    • getTopLevelTypeName

      public static String getTopLevelTypeName(org.mule.metadata.api.model.MetadataType metadataType)
      Returns a hypenized name of the give top level metadataType.

      This method will look for the TypeAliasAnnotation of the MetadataType to get the type simple name.

      As a fallback, it uses ClassInformationAnnotation.getClassname() to obtain the simple name of the class. Finally if there is no ClassInformation, the TypeIdAnnotation will be used as Alias, failing if it is not found.

      Parameters:
      metadataType - the MetadataType which name you want
      Returns:
      the hypenized name for the given type
    • getAliasName

      public static String getAliasName(org.mule.metadata.api.model.MetadataType metadataType)
      This method will look for the TypeAliasAnnotation of the MetadataType to get the type simple name.

      As a fallback, it uses ClassInformationAnnotation.getClassname() to obtain the simple name of the class. Finally if there is no ClassInformation, the TypeIdAnnotation will be used as Alias, failing if it is not found.

      Parameters:
      metadataType - the MetadataType whose Alias is required
      Returns:
      the alias of the given type
    • getAliasName

      @Deprecated public static String getAliasName(Class<?> type)
      Deprecated.
      since 1.5.0 use JavaParserUtils.getAlias(Class) instead
    • getAliasName

      @Deprecated public static String getAliasName(Field field)
      Deprecated.
      since 1.5.0 use TypeUtils.getAlias(Field) instead
    • getAliasName

      public static String getAliasName(Parameter parameter)
    • defaultNamespace

      public static String defaultNamespace(String extensionName)
    • getComponentModelTypeName

      public static String getComponentModelTypeName(org.mule.runtime.api.meta.model.parameter.ParameterizedModel component)
    • getDeclarationTypeName

      public static String getDeclarationTypeName(org.mule.runtime.api.meta.model.declaration.fluent.ParameterizedDeclaration declaration)
    • getComponentDeclarationTypeName

      public static String getComponentDeclarationTypeName(org.mule.runtime.api.meta.model.declaration.fluent.BaseDeclaration declaration)
    • getModelName

      public static String getModelName(Object model)
    • alphaSortDescribedList

      public static <T extends org.mule.runtime.api.meta.NamedObject> List<T> alphaSortDescribedList(List<T> list)
      Sorts the given list in ascending alphabetic order, using NamedObject.getName() as the sorting criteria
      Type Parameters:
      T - the generic type of the items in the list
      Parameters:
      list - a List with instances of NamedObject
      Returns:
      the sorted list