Checks the preconditions for creating a new HashMapper processor.

@param mapping
the Map
@throws NullPointerException
if mapping is null
@throws IllegalArgumentException
if mapping is empty
492429
private static void checkPreconditions(final Map<Object, Object> mapping) {
		if( mapping == null ) {
			throw new NullPointerException("mapping should not be null");
		} else if( mapping.isEmpty() ) {
			throw new IllegalArgumentException("mapping should not be empty");
		}
	}
747964
public static <K, V> SortedMap<K, V> nullToEmpty(final SortedMap<K, V> map) {
        return map == null ? N.<K, V> emptySortedMap() : map;
    }
569133
public void addDSLMapping(final DSLMapping mapping) {
        for ( DSLMappingEntry entry : mapping.getEntries() ) {
            if ( DSLMappingEntry.KEYWORD.equals( entry.getSection() ) ) {
                this.keywords.add( entry );
            } else if ( DSLMappingEntry.CONDITION.equals( entry.getSection() ) ) {
                this.condition.add( entry );
            } else if ( DSLMappingEntry.CONSEQUENCE.equals( entry.getSection() ) ) {
                this.consequence.add( entry );
            } else {
                // if any, then add to them both condition and consequence
                this.condition.add( entry );
                this.consequence.add( entry );
            }
        }

        if ( mapping.getOption( "result" ) ) showResult = true;
        if ( mapping.getOption( "steps" ) ) showSteps = true;
        if ( mapping.getOption( "keyword" ) ) showKeyword = true;
        if ( mapping.getOption( "when" ) ) showWhen = true;
        if ( mapping.getOption( "then" ) ) showThen = true;
        if ( mapping.getOption( "usage" ) ) showUsage = true;
    }
794020
private static void checkPreconditions(final Set<Object> possibleValues) {
		if( possibleValues == null ) {
			throw new NullPointerException("possibleValues Set should not be null");
		} else if( possibleValues.isEmpty() ) {
			throw new IllegalArgumentException("possibleValues Set should not be empty");
		}
	}
1248104
@SuppressWarnings({"unchecked", "rawtypes"})
    private void populateMap(Map map, Node node) {
        Map.Entry entry = getMapEntry(node);
        if (entry != null) {
            map.put(entry.getKey(), entry.getValue());
        }
    }
541663
void buildMapEntry(LinkedHashMap<Object, Expr> map) {
		Expr keyExpr = expr();
		Object key;
		if (keyExpr instanceof Id) {
			key = ((Id)keyExpr).getId();
		} else if (keyExpr instanceof Const) {
			key = ((Const)keyExpr).getValue();
		} else {
			throw new ParseException("Expression error: the value of map key must be identifier, String, Boolean, null or Number", location);
		}
		
		match(Sym.COLON);
		Expr value = expr();
		if (value == null) {
			throw new ParseException("Expression error: the value on the right side of map entry can not be blank", location);
		}
		map.put(key, value);
	}
460442
public void init(ObjectMapper objectMapper) {
        if (resultFactory == null) {
            resultFactory = new ImmediateResultFactory();
        }
        PreconditionUtil.verifyEquals(InitializedState.NOT_INITIALIZED, initializedState, "already initialized");
        this.initializedState = InitializedState.INITIALIZING;
        this.objectMapper = objectMapper;
        this.objectMapper.registerModules(getJacksonModules());
        typeParser.setObjectMapper(objectMapper);

        initializeModules();

        if (isServer) {
            applyRepositoryRegistrations();
            applyResourceRegistrations();
        }

        ExceptionMapperLookup exceptionMapperLookup = getExceptionMapperLookup();
        ExceptionMapperRegistryBuilder mapperRegistryBuilder = new ExceptionMapperRegistryBuilder();
        exceptionMapperRegistry = mapperRegistryBuilder.build(exceptionMapperLookup);

        filterBehaviorProvider =
                new ResourceFilterDirectoryImpl(aggregatedModule.getResourceFilters(), httpRequestContextProvider,
                        resourceRegistry);
        this.initializedState = InitializedState.INITIALIZED;
    }
954151
public static Object mapToObject(Map<String, String> map, Class<?> c) {

        Method m = null;
        Object obj = null;

        try {
            obj = c.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            log.info("instance create fail : " + c.getName());
            return null;
        }

        for (Map.Entry<String, String> entry : map.entrySet()) {

            if (entry.getValue() == null || entry.getValue().trim().isEmpty()) {
                continue;
            }

            if (entry.getValue().equalsIgnoreCase("undefined")) {
                continue;
            }

            try {
                m = findMethod(c, getSetMethodName(entry.getKey()));
                if (m == null) {
                    log.info("not found mapping method : " + entry.getKey());
                    continue;
                }
                try {
                    m.invoke(obj, castValue(m, m.getParameterTypes()[0], entry.getValue()));
                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
                    log.info("method invoke error : " + m.getName());
                }
            } catch (SecurityException e) {
                log.info("security exception : " + e.getMessage());
            }
        }

        return obj;
    }
1215870
public function addMapping(PathMapping $mapping)
    {
        if (!$mapping->isLoaded()) {
            throw new NotLoadedException('The passed mapping must be loaded.');
        }

        $moduleName = $mapping->getContainingModule()->getName();
        $previousMapping = isset($this->mappings[$moduleName]) ? $this->mappings[$moduleName] : null;

        if ($previousMapping === $mapping) {
            return;
        }

        if ($previousMapping) {
            $previousMapping->removeConflict($this);
        }

        $this->mappings[$moduleName] = $mapping;
        $mapping->addConflict($this);
    }
492508
public ParameterBuilder<T> properties(Map<String, Object> map) {
    if (map == null) {
      throw new IllegalArgumentException("Map argument must not be null.");
    }
    this.properties.putAll(map);
    return this;
  }
931496
public void setMapping(final Map<String, String> mapping) {
        this.uriMapping.clear();
        for (Map.Entry<String, String> entry: mapping.entrySet()) {
            Pattern pattern = Pattern.compile(entry.getKey());
            this.uriMapping.put(pattern, entry.getValue());
        }
    }
339355
public static boolean allParametersAreHidden(Map<String, QueryParameter> map) {
        for (QueryParameter qp : map.values()) {
            if (!qp.isHidden()) {
                return false;
            }
        }
        return true;
    }
23544
@Override
	public OUTPUT newInstance(Map<String, INPUT> inputMap) throws FAILURE {
		
		StringBuilder builder = new StringBuilder()
		.append(getClass().getName())
		.append(".newInstance(Map<String, Input>) is unsupported.");
		
		throw new UnsupportedOperationException(builder.toString());
	}
298623
public static <S, T> Map<S, T> compactAndLockHashMap( HashMap<S, T> map )
  {
    if( map == null || map.isEmpty() )
    {
      return Collections.emptyMap();
    }

    if( map.size() == 1 )
    {
      Map.Entry<S, T> stEntry = map.entrySet().iterator().next();
      return Collections.singletonMap( stEntry.getKey(), stEntry.getValue() );
    }

    Map<S, T> newMap = new HashMap<S, T>( map.size(), 1 );
    newMap.putAll( map );
    return Collections.unmodifiableMap( newMap );
  }
28717
private static void initMap() {
    // Go through all the enum constants and build a map of
    // LayoutVersion <-> EnumSet of all supported features in that LayoutVersion
    for (Feature f : Feature.values()) {
      EnumSet<Feature> ancestorSet = map.get(f.ancestorLV);
      if (ancestorSet == null) {
        ancestorSet = EnumSet.noneOf(Feature.class); // Empty enum set
        map.put(f.ancestorLV, ancestorSet);
      }
      EnumSet<Feature> featureSet = EnumSet.copyOf(ancestorSet);
      featureSet.add(f);
      map.put(f.lv, featureSet);
    }
    
    // Special initialization for 0.20.203 and 0.20.204
    // to add Feature#DELEGATION_TOKEN
    specialInit(Feature.RESERVED_REL20_203.lv, Feature.DELEGATION_TOKEN);
    specialInit(Feature.RESERVED_REL20_204.lv, Feature.DELEGATION_TOKEN);
  }
1113697
public static void notEmpty(Map map, String name) {
    notNull(map, name);

    if (map.isEmpty()) {
      throw new IllegalArgumentException(name + " must not be empty");
    }
  }
738225
public void setTypeMap(Map<Class<? extends T>, C> map) {
		this.classified = new ConcurrentHashMap<Class<? extends T>, C>(map);
	}