本文整理汇总了Java中com.google.common.collect.ImmutableMap.Builder.putAll方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.putAll方法的具体用法?Java Builder.putAll怎么用?Java Builder.putAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableMap.Builder
的用法示例。
在下文中一共展示了Builder.putAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DtoTest
import com.google.common.collect.ImmutableMap.Builder; //导入方法依赖的package包/类
/**
* Creates an instance of {@link DtoTest} with ignore fields and additional custom mappers.
*
* @param customMappers Any custom mappers for a given class type.
* @param ignoreFields The getters which should be ignored (e.g., "getId" or "isActive").
*/
protected DtoTest(Map<Class<?>, Supplier<?>> customMappers, Set<String> ignoreFields) {
this.ignoredGetFields = new HashSet<>();
if (ignoreFields != null) {
this.ignoredGetFields.addAll(ignoreFields);
}
this.ignoredGetFields.add("getClass");
if (customMappers == null) {
this.mappers = DEFAULT_MAPPERS;
} else {
final Builder<Class<?>, Supplier<?>> builder = ImmutableMap.builder();
builder.putAll(customMappers);
builder.putAll(DEFAULT_MAPPERS);
this.mappers = builder.build();
}
}
示例2: testBuilderPutNullKeyViaPutAll
import com.google.common.collect.ImmutableMap.Builder; //导入方法依赖的package包/类
public void testBuilderPutNullKeyViaPutAll() {
Builder<String, Integer> builder = new Builder<String, Integer>();
try {
builder.putAll(Collections.<String, Integer>singletonMap(null, 1));
fail();
} catch (NullPointerException expected) {
}
}
示例3: testBuilderPutNullValueViaPutAll
import com.google.common.collect.ImmutableMap.Builder; //导入方法依赖的package包/类
public void testBuilderPutNullValueViaPutAll() {
Builder<String, Integer> builder = new Builder<String, Integer>();
try {
builder.putAll(Collections.<String, Integer>singletonMap("one", null));
fail();
} catch (NullPointerException expected) {
}
}
示例4: AbstractImportExport
import com.google.common.collect.ImmutableMap.Builder; //导入方法依赖的package包/类
public AbstractImportExport(TestConfig testConfig, String fullName, String shortName, String password,
String adminPassword, File baseDir, String fullUrl)
{
this.testConfig = testConfig;
this.baseDir = baseDir;
this.shortName = shortName;
this.fullName = fullName;
pageContext = new PageContext(testConfig, fullUrl);
this.password = password;
URI baseURI = pageContext.getBaseURI();
AdminTokenProvider token = new AdminTokenProvider(password);
Builder<String, BaseEntityRequests> entityTypesBuilder = ImmutableMap.builder();
// @formatter:off
entityTypesBuilder.putAll(ImmutableMap.of(
"schema", new SchemaRequests(baseURI, token, MAPPER, pageContext, this, testConfig),
"collection", new CollectionRequests(baseURI, token, MAPPER, pageContext, this, testConfig),
"oauth", new OAuthRequests(baseURI, token, MAPPER, pageContext, this, testConfig),
"workflow", new WorkflowRequests(baseURI, token, MAPPER, pageContext, this, testConfig)));
// @formatter:on
entityRequests = entityTypesBuilder.build();
searchRequests = new SearchRequests(baseURI, token, MAPPER, pageContext, testConfig);
itemRequests = new ItemRequests(baseURI, token, MAPPER, pageContext, this, testConfig);
userRequests = new UserRequests(baseURI, token, MAPPER, pageContext, this, testConfig);
groupRequests = new GroupRequests(baseURI, token, MAPPER, pageContext, this, testConfig);
roleRequests = new RoleRequests(baseURI, token, MAPPER, pageContext, this, testConfig);
aclRequests = new AclRequests(baseURI, token, MAPPER, pageContext, testConfig);
stagingRequests = new StagingRequests(baseURI, token, MAPPER, pageContext, testConfig);
URI adminUri = URI.create(testConfig.getAdminUrl());
instRequests = new InstitutionRequests(adminUri, MAPPER, pageContext, this, testConfig, adminPassword);
String proxyHost = testConfig.getProperty("proxy.host");
String proxyPortString = testConfig.getProperty("proxy.port");
if( proxyPortString != null )
{
System.setProperty("http.proxyHost", proxyHost);
System.setProperty("http.proxyPort", proxyPortString);
}
}
示例5: buildStorageHeaders
import com.google.common.collect.ImmutableMap.Builder; //导入方法依赖的package包/类
private Map<String, String> buildStorageHeaders(final String blobName,
@Nullable final Supplier<InputStream> streamSupplier,
@Nullable final Map<String, String> headers,
@Nullable final String declaredContentType,
final boolean skipContentVerification) throws IOException
{
checkArgument(
!skipContentVerification || !Strings2.isBlank(declaredContentType),
"skipContentVerification set true but no declaredContentType provided"
);
Builder<String, String> storageHeaders = ImmutableMap.builder();
storageHeaders.put(Bucket.REPO_NAME_HEADER, repositoryName);
storageHeaders.put(BlobStore.BLOB_NAME_HEADER, blobName);
storageHeaders.put(BlobStore.CREATED_BY_HEADER, createdBy);
storageHeaders.put(BlobStore.CREATED_BY_IP_HEADER, createdByIp);
if (!skipContentVerification) {
storageHeaders.put(
BlobStore.CONTENT_TYPE_HEADER,
determineContentType(streamSupplier, blobName, declaredContentType)
);
}
else {
storageHeaders.put(BlobStore.CONTENT_TYPE_HEADER, declaredContentType);
}
if (headers != null) {
storageHeaders.putAll(headers);
}
return storageHeaders.build();
}
示例6: getBeanMethods
import com.google.common.collect.ImmutableMap.Builder; //导入方法依赖的package包/类
private ImmutableMap<Method, InvocationHandler> getBeanMethods(final Class<?> entityInterface)
{
try
{
Builder<Method, InvocationHandler> builder = ImmutableMap.builder();
// first recurse up the hierarchy to find properties in all super interfaces
for (Class<?> superInterface : entityInterface.getInterfaces())
{
builder.putAll(getBeanMethods(superInterface));
}
// then add all of this interface's properties
for (PropertyDescriptor descriptor : getBeanInfo(entityInterface).getPropertyDescriptors())
{
Method readMethod = descriptor.getReadMethod();
if (readMethod != null)
{
builder.put(readMethod, new Getter(descriptor.getName()));
}
Method writeMethod = descriptor.getWriteMethod();
if (writeMethod != null)
{
builder.put(writeMethod, new Setter(descriptor.getName()));
}
}
return builder.build();
}
catch (IntrospectionException e)
{
throw new RuntimeException(e);
}
}
示例7: getParameters
import com.google.common.collect.ImmutableMap.Builder; //导入方法依赖的package包/类
@Override
public Map<String, Object> getParameters() {
Builder<String, Object> builder = ImmutableMap.<String, Object>builder();
builder.put("type", contentItem.getContentType());
Map<String, String> contentMap = contentItem.getValue().stream().filter(value -> value.getValue() != null)
.collect(Collectors.toMap(key -> mapItemType.get(key.getType()), Value::getValue));
builder.putAll(contentMap);
return builder.build();
}