本文整理匯總了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();
}