当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableMap类代码示例

本文整理汇总了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();
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:30,代码来源:AbstractBeanJsonCreator.java

示例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();
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:17,代码来源:BeanProcessor.java

示例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 ) );
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:43,代码来源:BeanProcessor.java

示例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;
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:9,代码来源:BeanTypeInfo.java

示例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;
    }
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:29,代码来源:BeanInfo.java

示例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;
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:16,代码来源:PropertiesContainer.java

示例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;
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:22,代码来源:BeanJsonMapperInfo.java

示例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;
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:9,代码来源:PropertiesContainer.java

示例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;
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:9,代码来源:BeanTypeInfo.java

示例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;
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:9,代码来源:BeanTypeInfo.java

示例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;
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:9,代码来源:BeanInfo.java


注:本文中的com.google.gwt.thirdparty.guava.common.collect.ImmutableMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。