Interface Label.Custom

  • All Superinterfaces:
    Label, javax.validation.Payload
    All Known Subinterfaces:
    IUploadConsuming.uploadElements, MultiFile.resources, MultiFile.searchFilename, MultiFile.urls, SingleFile.resource, SingleFile.searchFilename, SingleFile.url
    Enclosing interface:
    Label

    public static interface Label.Custom
    extends Label
    Use a custom label. Takes the nested path of the class extending this, and uses it as a lookup key in the resources bundle. Plugins should create a custom class that extends from this interface and specify the resource bundle. For example:
     abstract class BaseModel {
       @NotEmpty(payload = BaseModel.username)
       private String username;
     
       private static class username extends Label.Custom {
         public ResourceBundle getBundle() {
           // Get bundle from somewhere
           return I18nHelper.getResourceBundle();
         }
       }
     }
     
    You should then add the key BaseModel.username to your resource bundle.
    Since:
    7.0.0
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • getBundle

        default ResourceBundle getBundle()
        Gets the resource bundle to use for looking up the label. When this returns null, the default resource bundle from the formcycle application is used. This method should be overridden by plugins.
        Returns:
        The resource bundle to use for looking up the label.