src/main/java/de/blau/android/presets/PresetItem.java
/**
     * Adds a recommended or optional tag to the item and populates autosuggest
     * 
     * @param optional true if optional, false if recommended
     * @param key key name of the tag
     * @param type type of preset field
     * @param valueArray array with the values
     * @param delimiter the delimiter if more than one value is present
     * @param matchType the applicable MatchType
     * @return the allocated PresetField
     */
Adds a recommended or optional tag to the item and populates autosuggest


Adds a recommended or optional tag to the item and populates autosuggest
@NonNull
    public PresetField addTag(boolean optional, @NonNull String key, PresetKeyType type, StringWithDescription[] valueArray, final String delimiter,
            MatchType matchType) { 
        PresetField field = null;
        switch (type) {
        case COMBO:
        case MULTISELECT:
            field = new PresetComboField(key, valueArray);
            ((PresetComboField) field).setMultiSelect(type == PresetKeyType.MULTISELECT);
            if (!Preset.MULTISELECT_DELIMITER.equals(delimiter) || !Preset.COMBO_DELIMITER.equals(delimiter)) {
                ((PresetComboField) field).setDelimiter(delimiter);
            }
            break;
        case TEXT:
            field = new PresetTextField(key);
            break;
        case CHECK:
            Log.e(DEBUG_TAG, "check fields should not be handled here");
            throw new IllegalArgumentException("check fields should not be handled here");
        }
        field.setMatchType(matchType);  field can't be null here
        field.setOptional(optional);  field can't be null here
        fields.put(key, field);
        return field;
    }
@ NonNull public PresetField addTag ( boolean optional , @ NonNull String key , PresetKeyType type , StringWithDescription [ ] valueArray , final String delimiter , MatchType matchType ) { PresetField field = null ; switch ( type ) { case COMBO : case MULTISELECT : field = new PresetComboField ( key , valueArray ) ; ( ( PresetComboField ) field ) . setMultiSelect ( type == PresetKeyType . MULTISELECT ) ; if ( ! Preset . MULTISELECT_DELIMITER . equals ( delimiter ) || ! Preset . COMBO_DELIMITER . equals ( delimiter ) ) { ( ( PresetComboField ) field ) . setDelimiter ( delimiter ) ; } break ; case TEXT : field = new PresetTextField ( key ) ; break ; case CHECK : Log . e ( DEBUG_TAG , "check fields should not be handled here" ) ; throw new IllegalArgumentException ( "check fields should not be handled here" ) ; } field . setMatchType ( matchType ) ; field . setOptional ( optional ) ; fields . put ( key , field ) ; return field ; }
Adds a recommended or optional tag to the item and populates autosuggest
Adds a recommended or optional tag to the item and populates autosuggest
// NOSONAR // NOSONAR field can't be null here // NOSONAR field can't be null here