Class SimpleRegexRealmMapper

  • All Implemented Interfaces:
    RealmMapper
    Direct Known Subclasses:
    MappedRegexRealmMapper

    public class SimpleRegexRealmMapper
    extends Object
    implements RealmMapper
    A simple regular expression-based realm mapper. The realm name pattern must contain a single capture group which matches the substring to use as the realm name. If the substring is not matched, the delegate realm mapper is used. If there is no delegate realm mapper, the default realm is used.
    Author:
    David M. Lloyd
    • Constructor Detail

      • SimpleRegexRealmMapper

        public SimpleRegexRealmMapper​(Pattern realmNamePattern)
        Construct a new instance.
        Parameters:
        realmNamePattern - the realm name pattern, which must contain at least one capture group (cannot be null)
        Throws:
        IllegalArgumentException - if the given pattern does not contain a capture group
      • SimpleRegexRealmMapper

        public SimpleRegexRealmMapper​(Pattern realmNamePattern,
                                      RealmMapper delegate)
        Construct a new instance.
        Parameters:
        realmNamePattern - the realm name pattern, which must contain at least one capture group (cannot be null)
        delegate - the delegate mapper to use if the pattern is not matched (cannot be null)
        Throws:
        IllegalArgumentException - if the given pattern does not contain a capture group