List of usage examples for com.google.common.collect Maps newEnumMap
public static <K extends Enum<K>, V> EnumMap<K, V> newEnumMap(Map<K, ? extends V> map)
From source file:org.eclipse.incquery.runtime.internal.engine.ModelUpdateProvider.java
public ModelUpdateProvider(AdvancedIncQueryEngine incQueryEngine, Logger logger) { super();// w ww. j a va 2s .c o m this.incQueryEngine = incQueryEngine; this.logger = logger; Map<ChangeLevel, Collection<IncQueryModelUpdateListener>> map = Maps.newEnumMap(ChangeLevel.class); listenerMap = Multimaps.newSetMultimap(map, new com.google.common.base.Supplier<Set<IncQueryModelUpdateListener>>() { @Override public Set<IncQueryModelUpdateListener> get() { return Sets.newHashSet(); } }); }
From source file:fr.javatronic.damapping.toolkit.enums.StringEnumMapperMaps.java
/** * Creates a new instance of StringEnumMapperMaps which backing maps will be populated from the result of the * specified BijectiveTransformer.//from w w w .j a v a 2 s. c om * * @param clazz an enum type class * @param bijectiveTransformer a {@link fr.javatronic.damapping.toolkit.enums.BijectiveTransformer} */ public StringEnumMapperMaps(@Nonnull Class<E> clazz, @Nonnull BijectiveTransformer<E> bijectiveTransformer) { EnumMap<E, String> enumStrMap = Maps.newEnumMap(clazz); ImmutableMap.Builder<String, E> strEnumBuilder = ImmutableMap.builder(); for (E enumConstant : clazz.getEnumConstants()) { String str = requireNonNull(bijectiveTransformer.apply(enumConstant), "String representation of value " + enumConstant + " can not be null"); enumStrMap.put(enumConstant, str); strEnumBuilder.put(str, enumConstant); } this.enumToString = Maps.immutableEnumMap(enumStrMap); this.stringToEnum = strEnumBuilder.build(); }
From source file:com.torodb.torod.db.backends.mysql.converters.array.MySQLValueToArrayDataTypeProvider.java
private MySQLValueToArrayDataTypeProvider() { MySQLValueToArrayConverterProvider valueToArrayConverterProvider = MySQLValueToArrayConverterProvider .getInstance();// w ww .java 2 s.c o m converters = Maps.newEnumMap(ScalarType.class); converters.put(ScalarType.ARRAY, ArrayToJooqConverter.fromScalarValue(ScalarArray.class, valueToArrayConverterProvider.getArrayConverter(), "json")); converters.put(ScalarType.BOOLEAN, ArrayToJooqConverter.fromScalarValue(ScalarBoolean.class, valueToArrayConverterProvider.getBooleanConverter(), "json")); converters.put(ScalarType.DATE, ArrayToJooqConverter.fromScalarValue(ScalarDate.class, valueToArrayConverterProvider.getDateConverter(), "json")); converters.put(ScalarType.INSTANT, ArrayToJooqConverter.fromScalarValue(ScalarInstant.class, valueToArrayConverterProvider.getInstantConverter(), "json")); converters.put(ScalarType.DOUBLE, ArrayToJooqConverter.fromScalarValue(ScalarDouble.class, valueToArrayConverterProvider.getDoubleConverter(), "json")); converters.put(ScalarType.INTEGER, ArrayToJooqConverter.fromScalarValue(ScalarInteger.class, valueToArrayConverterProvider.getIntegerConverter(), "json")); converters.put(ScalarType.LONG, ArrayToJooqConverter.fromScalarValue(ScalarLong.class, valueToArrayConverterProvider.getLongConverter(), "json")); converters.put(ScalarType.NULL, ArrayToJooqConverter.fromScalarValue(ScalarNull.class, valueToArrayConverterProvider.getNullConverter(), "json")); converters.put(ScalarType.STRING, ArrayToJooqConverter.fromScalarValue(ScalarString.class, valueToArrayConverterProvider.getStringConverter(), "json")); converters.put(ScalarType.TIME, ArrayToJooqConverter.fromScalarValue(ScalarTime.class, valueToArrayConverterProvider.getTimeConverter(), "json")); converters.put(ScalarType.MONGO_OBJECT_ID, ArrayToJooqConverter.fromScalarValue(ScalarMongoObjectId.class, valueToArrayConverterProvider.getMongoObjectIdConverter(), "json")); converters.put(ScalarType.MONGO_TIMESTAMP, ArrayToJooqConverter.fromScalarValue(ScalarMongoTimestamp.class, valueToArrayConverterProvider.getMongoTimestampConverter(), "json")); converters.put(ScalarType.BINARY, ArrayToJooqConverter.fromScalarValue(ScalarBinary.class, valueToArrayConverterProvider.getBinaryConverter(), "json")); }
From source file:org.zenoss.zep.index.impl.BaseQueryBuilder.java
protected BaseQueryBuilder(Occur occur) { this.occur = occur; subClauses = Sets.newHashSet();//from www. j ava2 s. c om fieldsValues = Maps.newEnumMap(FieldType.class); for (FieldType type : FieldType.values()) fieldsValues.put(type, new HashMap<String, Set<?>>()); }
From source file:de.xaniox.heavyspleef.core.flag.FlagManager.java
public FlagManager(JavaPlugin plugin, GamePropertyBundle defaults, boolean migrateManager) { this.plugin = plugin; this.defaults = defaults; this.flags = HashBiMap.create(); this.disabledFlags = Sets.newHashSet(); this.unloadedFlags = Lists.newArrayList(); this.propertyBundles = Sets.newTreeSet(); this.requestedProperties = new DefaultGamePropertyBundle(Maps.newEnumMap(GameProperty.class)); this.migrateManager = migrateManager; }
From source file:com.torodb.torod.db.backends.postgresql.converters.array.PostgreSQLValueToArrayDataTypeProvider.java
private PostgreSQLValueToArrayDataTypeProvider() { PostgreSQLValueToArrayConverterProvider postgreSQLValueToArrayConverterProvider = PostgreSQLValueToArrayConverterProvider .getInstance();/*from w ww . ja va2 s . c om*/ converters = Maps.newEnumMap(ScalarType.class); converters.put(ScalarType.ARRAY, JSONBBinding.fromScalarValue(ScalarArray.class, postgreSQLValueToArrayConverterProvider.getArrayConverter())); converters.put(ScalarType.BOOLEAN, JSONBBinding.fromScalarValue(ScalarBoolean.class, postgreSQLValueToArrayConverterProvider.getBooleanConverter())); converters.put(ScalarType.DATE, JSONBBinding.fromScalarValue(ScalarDate.class, postgreSQLValueToArrayConverterProvider.getDateConverter())); converters.put(ScalarType.INSTANT, JSONBBinding.fromScalarValue(ScalarInstant.class, postgreSQLValueToArrayConverterProvider.getInstantConverter())); converters.put(ScalarType.DOUBLE, JSONBBinding.fromScalarValue(ScalarDouble.class, postgreSQLValueToArrayConverterProvider.getDoubleConverter())); converters.put(ScalarType.INTEGER, JSONBBinding.fromScalarValue(ScalarInteger.class, postgreSQLValueToArrayConverterProvider.getIntegerConverter())); converters.put(ScalarType.LONG, JSONBBinding.fromScalarValue(ScalarLong.class, postgreSQLValueToArrayConverterProvider.getLongConverter())); converters.put(ScalarType.NULL, JSONBBinding.fromScalarValue(ScalarNull.class, postgreSQLValueToArrayConverterProvider.getNullConverter())); converters.put(ScalarType.STRING, JSONBBinding.fromScalarValue(ScalarString.class, postgreSQLValueToArrayConverterProvider.getStringConverter())); converters.put(ScalarType.TIME, JSONBBinding.fromScalarValue(ScalarTime.class, postgreSQLValueToArrayConverterProvider.getTimeConverter())); converters.put(ScalarType.MONGO_OBJECT_ID, JSONBBinding.fromScalarValue(ScalarMongoObjectId.class, postgreSQLValueToArrayConverterProvider.getMongoObjectIdConverter())); converters.put(ScalarType.MONGO_TIMESTAMP, JSONBBinding.fromScalarValue(ScalarMongoTimestamp.class, postgreSQLValueToArrayConverterProvider.getMongoTimestampConverter())); converters.put(ScalarType.BINARY, JSONBBinding.fromScalarValue(ScalarBinary.class, postgreSQLValueToArrayConverterProvider.getBinaryConverter())); }
From source file:com.torodb.torod.db.backends.greenplum.converters.array.GreenplumValueToArrayDataTypeProvider.java
private GreenplumValueToArrayDataTypeProvider() { GreenplumValueToArrayConverterProvider greenplumValueToArrayConverterProvider = GreenplumValueToArrayConverterProvider .getInstance();// w w w . j a va 2s . c om converters = Maps.newEnumMap(ScalarType.class); converters.put(ScalarType.ARRAY, ArrayToJooqConverter.fromScalarValue(ScalarArray.class, greenplumValueToArrayConverterProvider.getArrayConverter(), "json")); converters.put(ScalarType.BOOLEAN, ArrayToJooqConverter.fromScalarValue(ScalarBoolean.class, greenplumValueToArrayConverterProvider.getBooleanConverter(), "json")); converters.put(ScalarType.DATE, ArrayToJooqConverter.fromScalarValue(ScalarDate.class, greenplumValueToArrayConverterProvider.getDateConverter(), "json")); converters.put(ScalarType.INSTANT, ArrayToJooqConverter.fromScalarValue(ScalarInstant.class, greenplumValueToArrayConverterProvider.getInstantConverter(), "json")); converters.put(ScalarType.DOUBLE, ArrayToJooqConverter.fromScalarValue(ScalarDouble.class, greenplumValueToArrayConverterProvider.getDoubleConverter(), "json")); converters.put(ScalarType.INTEGER, ArrayToJooqConverter.fromScalarValue(ScalarInteger.class, greenplumValueToArrayConverterProvider.getIntegerConverter(), "json")); converters.put(ScalarType.LONG, ArrayToJooqConverter.fromScalarValue(ScalarLong.class, greenplumValueToArrayConverterProvider.getLongConverter(), "json")); converters.put(ScalarType.NULL, ArrayToJooqConverter.fromScalarValue(ScalarNull.class, greenplumValueToArrayConverterProvider.getNullConverter(), "json")); converters.put(ScalarType.STRING, ArrayToJooqConverter.fromScalarValue(ScalarString.class, greenplumValueToArrayConverterProvider.getStringConverter(), "json")); converters.put(ScalarType.TIME, ArrayToJooqConverter.fromScalarValue(ScalarTime.class, greenplumValueToArrayConverterProvider.getTimeConverter(), "json")); converters.put(ScalarType.MONGO_OBJECT_ID, ArrayToJooqConverter.fromScalarValue(ScalarMongoObjectId.class, greenplumValueToArrayConverterProvider.getMongoObjectIdConverter(), "json")); converters.put(ScalarType.MONGO_TIMESTAMP, ArrayToJooqConverter.fromScalarValue(ScalarMongoTimestamp.class, greenplumValueToArrayConverterProvider.getMongoTimestampConverter(), "json")); converters.put(ScalarType.BINARY, ArrayToJooqConverter.fromScalarValue(ScalarBinary.class, greenplumValueToArrayConverterProvider.getBinaryConverter(), "json")); }
From source file:de.gtrefs.ai.ludo.model.Board.java
private void buildBoard() { startFieldsByColor = buildFieldsByType(StartField.class); endFieldsByColor = buildFieldsByType(EndField.class); beginFieldsByColor = buildBeginFields(); fieldsSortedByColor = Maps.newEnumMap(Game.Color.class); boardFields = Lists.newArrayList();//from ww w .j a v a 2 s. com buildFieldsSortedByColor(); createPawnsPerColor(); }
From source file:org.apache.tez.mapreduce.hadoop.DeprecatedKeys.java
private static Map<MultiStageKeys, String> getDeprecationMap(String inputKey, String outputKey) { Map<MultiStageKeys, String> m = Maps.newEnumMap(MultiStageKeys.class); m.put(MultiStageKeys.INPUT, inputKey); m.put(MultiStageKeys.OUTPUT, outputKey); return m;/*w w w .j av a 2 s. c o m*/ }
From source file:datamine.storage.recordbuffers.example.data.SecondLevelNestedTableTestData.java
public static List<EnumMap<SecondLevelNestedTableMetadata, Object>> createInputData(int num) { List<EnumMap<SecondLevelNestedTableMetadata, Object>> dataList = Lists.newArrayList(); for (int i = 0; i < num; ++i) { EnumMap<SecondLevelNestedTableMetadata, Object> dataMap = Maps .newEnumMap(SecondLevelNestedTableMetadata.class); {//from ww w .j a v a2 s . co m Object val = RandomValueGenerator .getValueOf(((PrimitiveFieldType) SecondLevelNestedTableMetadata.BYTE_REQUIRED_COLUMN .getField().getType()).getPrimitiveType()); if (val != null) { dataMap.put(SecondLevelNestedTableMetadata.BYTE_REQUIRED_COLUMN, val); } } { Object val = RandomValueGenerator.getValueArrayOf( ((PrimitiveFieldType) ((CollectionFieldType) SecondLevelNestedTableMetadata.BOOLEAN_LIST_COLUMN .getField().getType()).getElementType()).getPrimitiveType(), num); if (val != null && !((List) val).isEmpty()) { dataMap.put(SecondLevelNestedTableMetadata.BOOLEAN_LIST_COLUMN, val); } } if (!dataMap.isEmpty()) { dataList.add(dataMap); } } return dataList; }