本文整理汇总了Java中com.google.gwt.thirdparty.guava.common.collect.ImmutableMap类的典型用法代码示例。如果您正苦于以下问题:Java ImmutableMap类的具体用法?Java ImmutableMap怎么用?Java ImmutableMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableMap类属于com.google.gwt.thirdparty.guava.common.collect包,在下文中一共展示了ImmutableMap类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateTypeInfo
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
/**
* Build the code to initialize a {@link TypeSerializationInfo} or {@link TypeDeserializationInfo}.
*
* @param typeInfo the type information obtained through the {@link JsonTypeInfo} annotation
* @return the code built
*/
protected final CodeBlock generateTypeInfo( BeanTypeInfo typeInfo ) {
Class type;
ImmutableMap<JClassType, String> mapTypeToMetadata;
if ( isSerializer() ) {
type = TypeSerializationInfo.class;
mapTypeToMetadata = typeInfo.getMapTypeToSerializationMetadata();
} else {
type = TypeDeserializationInfo.class;
mapTypeToMetadata = typeInfo.getMapTypeToDeserializationMetadata();
}
CodeBlock.Builder builder = CodeBlock.builder()
.add( "new $T($T.$L, $S)", type, As.class, typeInfo.getInclude(), typeInfo.getPropertyName() )
.indent()
.indent();
for ( Entry<JClassType, String> entry : mapTypeToMetadata.entrySet() ) {
builder.add( "\n.addTypeInfo($T.class, $S)", rawName( entry.getKey() ), entry.getValue() );
}
return builder.unindent().unindent().build();
}
示例2: extractMetadata
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
private static ImmutableMap<JClassType, String> extractMetadata( TreeLogger logger, RebindConfiguration configuration, JClassType
type, Optional<JsonTypeInfo> jsonTypeInfo, Optional<JsonSubTypes> propertySubTypes, Optional<JsonSubTypes> typeSubTypes,
ImmutableList<JClassType> allSubtypes ) throws
UnableToCompleteException {
ImmutableMap.Builder<JClassType, String> classToMetadata = ImmutableMap.builder();
classToMetadata.put( type, extractTypeMetadata( logger, configuration, type, type, jsonTypeInfo
.get(), propertySubTypes, typeSubTypes, allSubtypes ) );
for ( JClassType subtype : allSubtypes ) {
classToMetadata.put( subtype, extractTypeMetadata( logger, configuration, type, subtype, jsonTypeInfo
.get(), propertySubTypes, typeSubTypes, allSubtypes ) );
}
return classToMetadata.build();
}
示例3: processType
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
/**
* <p>processType</p>
*
* @param logger a {@link com.google.gwt.core.ext.TreeLogger} object.
* @param typeOracle a {@link com.github.nmorel.gwtjackson.rebind.JacksonTypeOracle} object.
* @param configuration a {@link com.github.nmorel.gwtjackson.rebind.RebindConfiguration} object.
* @param typeOracle a {@link com.github.nmorel.gwtjackson.rebind.JacksonTypeOracle} object.
* @param type a {@link com.google.gwt.core.ext.typeinfo.JClassType} object.
* @param jsonTypeInfo a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
* @param propertySubTypes a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
* @return a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
* @throws com.google.gwt.core.ext.UnableToCompleteException if any.
*/
public static Optional<BeanTypeInfo> processType( TreeLogger logger, JacksonTypeOracle typeOracle, RebindConfiguration configuration,
JClassType type, Optional<JsonTypeInfo> jsonTypeInfo, Optional<JsonSubTypes>
propertySubTypes ) throws UnableToCompleteException {
if ( !jsonTypeInfo.isPresent() ) {
jsonTypeInfo = findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type, JsonTypeInfo.class );
if ( !jsonTypeInfo.isPresent() ) {
return Optional.absent();
}
}
Id use = jsonTypeInfo.get().use();
As include = jsonTypeInfo.get().include();
String propertyName = jsonTypeInfo.get().property().isEmpty() ? jsonTypeInfo.get().use().getDefaultPropertyName() : jsonTypeInfo
.get().property();
Optional<JsonSubTypes> typeSubTypes = findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type, JsonSubTypes.class );
// TODO we could do better, we actually extract metadata twice for a lot of classes
ImmutableMap<JClassType, String> classToSerializationMetadata = extractMetadata( logger, configuration, type, jsonTypeInfo,
propertySubTypes, typeSubTypes, CreatorUtils
.filterSubtypesForSerialization( logger, configuration, type ) );
ImmutableMap<JClassType, String> classToDeserializationMetadata = extractMetadata( logger, configuration, type, jsonTypeInfo,
propertySubTypes, typeSubTypes, CreatorUtils
.filterSubtypesForDeserialization( logger, configuration, type ) );
return Optional.of(
new BeanTypeInfo( use, include, propertyName, classToSerializationMetadata, classToDeserializationMetadata ) );
}
示例4: BeanTypeInfo
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
BeanTypeInfo( Id use, As include, String propertyName, ImmutableMap<JClassType, String> mapTypeToSerializationMetadata,
ImmutableMap<JClassType, String> mapTypeToDeserializationMetadata ) {
this.use = use;
this.include = include;
this.propertyName = propertyName;
this.mapTypeToSerializationMetadata = mapTypeToSerializationMetadata;
this.mapTypeToDeserializationMetadata = mapTypeToDeserializationMetadata;
}
示例5: BeanInfo
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
BeanInfo( JClassType type, List<JClassType> parameterizedTypes, Optional<JClassType> builder, Optional<JAbstractMethod> creatorMethod, Map<String, JParameter> creatorParameters, boolean creatorDefaultConstructor, boolean creatorDelegation, Optional<BeanTypeInfo> typeInfo, Optional<PropertyInfo> valuePropertyInfo, Optional<PropertyInfo> anyGetterPropertyInfo, Optional<PropertyInfo> anySetterPropertyInfo, Set<String> ignoredFields, Visibility fieldVisibility, Visibility getterVisibility, Visibility isGetterVisibility, Visibility setterVisibility, Visibility creatorVisibility, boolean ignoreUnknown, List<String> propertyOrderList, boolean propertyOrderAlphabetic, Optional<BeanIdentityInfo> identityInfo, Optional<Include> include ) {
this.type = type;
this.parameterizedTypes = ImmutableList.copyOf( parameterizedTypes );
this.builder = builder;
this.creatorMethod = creatorMethod;
this.creatorParameters = ImmutableMap.copyOf( creatorParameters );
this.creatorDefaultConstructor = creatorDefaultConstructor;
this.creatorDelegation = creatorDelegation;
this.typeInfo = typeInfo;
this.valuePropertyInfo = valuePropertyInfo;
this.anyGetterPropertyInfo = anyGetterPropertyInfo;
this.anySetterPropertyInfo = anySetterPropertyInfo;
this.ignoredFields = ImmutableSet.copyOf( ignoredFields );
this.fieldVisibility = fieldVisibility;
this.getterVisibility = getterVisibility;
this.isGetterVisibility = isGetterVisibility;
this.setterVisibility = setterVisibility;
this.creatorVisibility = creatorVisibility;
this.ignoreUnknown = ignoreUnknown;
this.propertyOrderList = ImmutableList.copyOf( propertyOrderList );
this.propertyOrderAlphabetic = propertyOrderAlphabetic;
this.identityInfo = identityInfo;
this.include = include;
}
示例6: PropertiesContainer
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
/**
* <p>Constructor for PropertiesContainer.</p>
*
* @param properties a {@link com.google.gwt.thirdparty.guava.common.collect.ImmutableMap} object.
* @param valuePropertyInfo a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
* @param anyGetterPropertyInfo a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
* @param anySetterPropertyInfo a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
*/
public PropertiesContainer( ImmutableMap<String, PropertyInfo> properties, Optional<PropertyInfo> valuePropertyInfo,
Optional<PropertyInfo> anyGetterPropertyInfo, Optional<PropertyInfo> anySetterPropertyInfo ) {
this.properties = properties;
this.valuePropertyInfo = valuePropertyInfo;
this.anyGetterPropertyInfo = anyGetterPropertyInfo;
this.anySetterPropertyInfo = anySetterPropertyInfo;
}
示例7: BeanJsonMapperInfo
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
/**
* <p>Constructor for BeanJsonMapperInfo.</p>
*
* @param type a {@link com.google.gwt.core.ext.typeinfo.JClassType} object.
* @param packageName a {@link java.lang.String} object.
* @param samePackage a boolean.
* @param simpleSerializerClassName a {@link java.lang.String} object.
* @param simpleDeserializerClassName a {@link java.lang.String} object.
* @param beanInfo a {@link com.github.nmorel.gwtjackson.rebind.bean.BeanInfo} object.
* @param properties a {@link com.google.gwt.thirdparty.guava.common.collect.ImmutableMap} object.
*/
public BeanJsonMapperInfo( JClassType type, String packageName, boolean samePackage, String simpleSerializerClassName,
String simpleDeserializerClassName, BeanInfo beanInfo, ImmutableMap<String, PropertyInfo> properties ) {
this.type = type;
this.packageName = packageName;
this.samePackage = samePackage;
this.simpleSerializerClassName = simpleSerializerClassName;
this.simpleDeserializerClassName = simpleDeserializerClassName;
this.beanInfo = beanInfo;
this.properties = properties;
}
示例8: getProperties
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
/**
* <p>Getter for the field <code>properties</code>.</p>
*
* @return a {@link com.google.gwt.thirdparty.guava.common.collect.ImmutableMap} object.
*/
public ImmutableMap<String, PropertyInfo> getProperties() {
return properties;
}
示例9: getMapTypeToSerializationMetadata
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
/**
* <p>Getter for the field <code>mapTypeToSerializationMetadata</code>.</p>
*
* @return a {@link com.google.gwt.thirdparty.guava.common.collect.ImmutableMap} object.
*/
public ImmutableMap<JClassType, String> getMapTypeToSerializationMetadata() {
return mapTypeToSerializationMetadata;
}
示例10: getMapTypeToDeserializationMetadata
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
/**
* <p>Getter for the field <code>mapTypeToDeserializationMetadata</code>.</p>
*
* @return a {@link com.google.gwt.thirdparty.guava.common.collect.ImmutableMap} object.
*/
public ImmutableMap<JClassType, String> getMapTypeToDeserializationMetadata() {
return mapTypeToDeserializationMetadata;
}
示例11: getCreatorParameters
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; //导入依赖的package包/类
/**
* <p>Getter for the field <code>creatorParameters</code>.</p>
*
* @return a {@link com.google.gwt.thirdparty.guava.common.collect.ImmutableMap} object.
*/
public ImmutableMap<String, JParameter> getCreatorParameters() {
return creatorParameters;
}