Changeset 1230 for trunk


Ignore:
Timestamp:
02/04/19 13:44:13 (5 years ago)
Author:
bln4
Message:

org.expeditee.auth.AuthenticationTag ->

Optionally choose not to use defaults (equiv to default being null)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/auth/AuthenticationTag.java

    r1202 r1230  
    2626        }
    2727       
    28         public static Optional<Map<AuthenticationTag, String>> fetchUserData(final Collection<Text> from, final AuthenticationTag... tags) {
     28        public static Optional<Map<AuthenticationTag, String>> fetchUserData(Collection<Text> from, boolean useDefaults, AuthenticationTag... tags) {
    2929                final Map<AuthenticationTag, String> fetchedData = new HashMap<AuthenticationTag, String>();
    3030               
    31                 for (final AuthenticationTag tag: tags) {
    32                         for (final Text canditate: from) {
     31                for (AuthenticationTag tag: tags) {
     32                        for (Text canditate: from) {
    3333                                // use the canditate if it exists
    3434                                if (canditate.hasData(tag.val)) {
     
    3737                                }
    3838                                // otherwise try use the default
    39                                 final String property = tag.def;
     39                                String property = tag.def;
    4040                                if (property != null && !property.isEmpty()) {
    41                                         fetchedData.put(tag, property);
     41                                        fetchedData.put(tag, useDefaults ? property : null);
    4242                                }
    4343                        }
Note: See TracChangeset for help on using the changeset viewer.