Class CMAAsset.Fields

  • Enclosing class:
    CMAAsset

    public static class CMAAsset.Fields
    extends java.lang.Object
    Collect all fields of an asset.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  CMAAsset.Fields.Localized
      Localize all fields with a given locale.
    • Constructor Summary

      Constructors 
      Constructor Description
      Fields()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDescription​(java.lang.String locale)
      Retrieve the description to the given locale.
      CMAAssetFile getFile​(java.lang.String locale)
      Return the localized file of this asset.
      java.lang.String getTitle​(java.lang.String locale)
      What is the title of this asset in a given locale?
      CMAAsset.Fields.Localized localize​(java.lang.String locale)
      Localize access to fields by the same locale.
      CMAAsset.Fields setDescription​(java.lang.String locale, java.lang.String description)
      Set the description in a specific locale.
      CMAAsset.Fields setFile​(java.lang.String locale, CMAAssetFile file)
      Update or create a new file for this asset.
      CMAAsset.Fields setTitle​(java.lang.String locale, java.lang.String title)
      Update or set title in a given locale.
      java.lang.String toString()
      For debugging, it returns only the en-US locales!
      java.lang.String toString​(java.lang.String locale)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Fields

        public Fields()
    • Method Detail

      • getDescription

        public java.lang.String getDescription​(java.lang.String locale)
        Retrieve the description to the given locale.
        Parameters:
        locale - which locale should the description be in?
        Returns:
        a string representing the description in the given locale.
      • setDescription

        public CMAAsset.Fields setDescription​(java.lang.String locale,
                                              java.lang.String description)
        Set the description in a specific locale.
        Parameters:
        locale - the locale to be used. Think 'en-US'.
        description - the text of the description, localized into the locale.
        Returns:
        the CMAAsset.Fields instance calling, used for chaining.
      • getTitle

        public java.lang.String getTitle​(java.lang.String locale)
        What is the title of this asset in a given locale?
        Parameters:
        locale - the locale to check for a title
        Returns:
        the localized title, or null if no entry for this locale was found.
      • setTitle

        public CMAAsset.Fields setTitle​(java.lang.String locale,
                                        java.lang.String title)
        Update or set title in a given locale.

        If a title in the given locale is present, update it, otherwise create a new one.

        Parameters:
        locale - which locale to be used.
        title - the title corresponding to this locale.
        Returns:
        The same CMAAsset.Fields instance used to calling other setters for chaining.
      • getFile

        public CMAAssetFile getFile​(java.lang.String locale)
        Return the localized file of this asset.

        Returns CMAAssetFile for the given locale.

        Parameters:
        locale - which locale should be used to select the right file?
        Returns:
        the CMAAssetFile listed under the given locale.
      • setFile

        public CMAAsset.Fields setFile​(java.lang.String locale,
                                       CMAAssetFile file)
        Update or create a new file for this asset.
        Parameters:
        locale - which locale to be used?
        file - the actual file to be set.
        Returns:
        For chaining, return the same instance getting called with.
      • localize

        public CMAAsset.Fields.Localized localize​(java.lang.String locale)
        Localize access to fields by the same locale.

        Use this to not keep repeating the same locale for fields.

        Parameters:
        locale - a code of a locale. Think `en-US`.
        Returns:
        a visitor to localize all upcoming field access.
      • toString

        public java.lang.String toString​(java.lang.String locale)
        Parameters:
        locale - the locale to be used for converting.
        Returns:
        a human readable string, representing the object.
      • toString

        public java.lang.String toString()
        For debugging, it returns only the en-US locales!
        Overrides:
        toString in class java.lang.Object
        Returns:
        a human readable string, representing the object.
        See Also:
        toString(String)