Java Code Examples for com.google.gwt.core.ext.typeinfo.JType#isClass()

The following examples show how to use com.google.gwt.core.ext.typeinfo.JType#isClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RebindConfiguration.java    From gwt-jackson with Apache License 2.0 4 votes vote down vote up
/**
 * Parse the configured serializer/deserializer configuration and put them into the corresponding map
 *
 * @param configuration configuration
 * @param mapperType type of the mapper
 * @param allSupportedSerializationClassBuilder builder aggregating all the types that have a serializer
 * @param allSupportedDeserializationClassBuilder builder aggregating all the types that have a deserializer
 */
private void addMappers( final AbstractConfiguration configuration, final MapperType mapperType, Builder<JClassType>
        allSupportedSerializationClassBuilder, Builder<JClassType> allSupportedDeserializationClassBuilder ) throws
        UnableToCompleteException {
    Map<Class, Class> configuredMapper = mapperType.getMapperTypeConfiguration( configuration );

    for ( Entry<Class, Class> entry : configuredMapper.entrySet() ) {

        JType mappedType = findType( entry.getKey() );
        if ( null == mappedType ) {
            continue;
        }

        JClassType mapperClassType = findClassType( entry.getValue() );
        if ( null == mapperClassType ) {
            continue;
        }

        if ( mapperType.isKey() ) {
            MapperInstance keyMapperInstance = getKeyInstance( mappedType, mapperClassType, mapperType.isSerializer() );
            if ( mapperType.isSerializer() ) {
                keySerializers.put( mappedType.getQualifiedSourceName(), keyMapperInstance );
            } else {
                keyDeserializers.put( mappedType.getQualifiedSourceName(), keyMapperInstance );
            }
        } else {
            MapperInstance mapperInstance = getInstance( mappedType, mapperClassType, mapperType.isSerializer() );
            if ( null != mapperInstance ) {
                if ( mapperType.isSerializer() ) {
                    serializers.put( mappedType.getQualifiedSourceName(), mapperInstance );
                    if ( null != mappedType.isClass() ) {
                        allSupportedSerializationClassBuilder.add( mappedType.isClass() );
                    }
                } else {
                    deserializers.put( mappedType.getQualifiedSourceName(), mapperInstance );
                    if ( null != mappedType.isClass() ) {
                        allSupportedDeserializationClassBuilder.add( mappedType.isClass() );
                    }
                }
            }
        }
    }
}
 
Example 2
Source File: CreatorUtils.java    From gwt-jackson with Apache License 2.0 2 votes vote down vote up
/**
 * <p>isObject</p>
 *
 * @param type the type to test
 * @return true if the type is {@link Object}, false otherwise
 */
public static boolean isObject( JType type ) {
    return null != type.isClass() && Object.class.getName().equals( type.getQualifiedSourceName() );
}
 
Example 3
Source File: JacksonTypeOracle.java    From gwt-jackson with Apache License 2.0 2 votes vote down vote up
/**
 * <p>isKeySerializer</p>
 *
 * @param type a {@link com.google.gwt.core.ext.typeinfo.JType} object.
 * @return a boolean.
 */
public boolean isKeySerializer( JType type ) {
    return null != type.isClass() && type.isClass().isAssignableTo( keySerializerType );
}
 
Example 4
Source File: JacksonTypeOracle.java    From gwt-jackson with Apache License 2.0 2 votes vote down vote up
/**
 * <p>isKeyDeserializer</p>
 *
 * @param type a {@link com.google.gwt.core.ext.typeinfo.JType} object.
 * @return a boolean.
 */
public boolean isKeyDeserializer( JType type ) {
    return null != type.isClass() && type.isClass().isAssignableTo( keyDeserializerType );
}
 
Example 5
Source File: JacksonTypeOracle.java    From gwt-jackson with Apache License 2.0 2 votes vote down vote up
/**
 * <p>isJsonSerializer</p>
 *
 * @param type a {@link com.google.gwt.core.ext.typeinfo.JType} object.
 * @return a boolean.
 */
public boolean isJsonSerializer( JType type ) {
    return null != type.isClass() && type.isClass().isAssignableTo( jsonSerializerType );
}
 
Example 6
Source File: JacksonTypeOracle.java    From gwt-jackson with Apache License 2.0 2 votes vote down vote up
/**
 * <p>isJsonDeserializer</p>
 *
 * @param type a {@link com.google.gwt.core.ext.typeinfo.JType} object.
 * @return a boolean.
 */
public boolean isJsonDeserializer( JType type ) {
    return null != type.isClass() && type.isClass().isAssignableTo( jsonDeserializerType );
}
 
Example 7
Source File: JacksonTypeOracle.java    From gwt-jackson with Apache License 2.0 2 votes vote down vote up
/**
 * <p>isJavaScriptObject</p>
 *
 * @param type a {@link com.google.gwt.core.ext.typeinfo.JType} object.
 * @return a boolean.
 */
public boolean isJavaScriptObject( JType type ) {
    return null != type.isClass() && type.isClass().isAssignableTo( jsoType );
}