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


Java ResolvedTypeWithMembers类代码示例

本文整理汇总了Java中com.fasterxml.classmate.ResolvedTypeWithMembers的典型用法代码示例。如果您正苦于以下问题:Java ResolvedTypeWithMembers类的具体用法?Java ResolvedTypeWithMembers怎么用?Java ResolvedTypeWithMembers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResolvedTypeWithMembers类属于com.fasterxml.classmate包,在下文中一共展示了ResolvedTypeWithMembers类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: constructorsIn

import com.fasterxml.classmate.ResolvedTypeWithMembers; //导入依赖的package包/类
/**
 * Finds the constructors in the given type
 *
 * @param resolvedType the type to search
 */
public com.google.common.collect.ImmutableList<ResolvedConstructor> constructorsIn(ResolvedType resolvedType) {
    MemberResolver resolver = new MemberResolver(typeResolver);
    resolver.setIncludeLangObject(false);
    if (resolvedType.getErasedType() == Object.class) {
        return ImmutableList.of();
    }
    ResolvedTypeWithMembers typeWithMembers = resolver.resolve(resolvedType, null, null);
    return FluentIterable
            .from(newArrayList(typeWithMembers.getConstructors())).toList();
}
 
开发者ID:Kixeye,项目名称:chassis,代码行数:16,代码来源:CustomAccessorsProvider.java

示例2: collectAttributes

import com.fasterxml.classmate.ResolvedTypeWithMembers; //导入依赖的package包/类
/**
 * Find all attributes for this configured class and add them to the corresponding map
 */
private void collectAttributes() {
	// find transient field and method names
	findTransientFieldAndMethodNames();

	// use the class mate library to generic types
	ResolvedTypeWithMembers resolvedType = localBindingContext.resolveMemberTypes(
			localBindingContext.getResolvedType(
					clazz
			)
	);
	for ( HierarchicType hierarchicType : resolvedType.allTypesAndOverrides() ) {
		if ( hierarchicType.getType().getErasedType().equals( clazz ) ) {
			resolvedType = localBindingContext.resolveMemberTypes( hierarchicType.getType() );
			break;
		}
	}

	if ( resolvedType == null ) {
		throw new AssertionFailure( "Unable to resolve types for " + clazz.getName() );
	}

	Set<String> explicitlyConfiguredMemberNames = createExplicitlyConfiguredAccessProperties( resolvedType );

	if ( AccessType.FIELD.equals( classAccessType ) ) {
		Field fields[] = clazz.getDeclaredFields();
		Field.setAccessible( fields, true );
		for ( Field field : fields ) {
			if ( isPersistentMember( transientFieldNames, explicitlyConfiguredMemberNames, field ) ) {
				createMappedAttribute( field, resolvedType, AccessType.FIELD );
			}
		}
	}
	else {
		Method[] methods = clazz.getDeclaredMethods();
		Method.setAccessible( methods, true );
		for ( Method method : methods ) {
			if ( isPersistentMember( transientMethodNames, explicitlyConfiguredMemberNames, method ) ) {
				createMappedAttribute( method, resolvedType, AccessType.PROPERTY );
			}
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:ConfiguredClass.java

示例3: resolveMemberTypes

import com.fasterxml.classmate.ResolvedTypeWithMembers; //导入依赖的package包/类
@Override
public ResolvedTypeWithMembers resolveMemberTypes(ResolvedType type) {
	return contextDelegate.resolveMemberTypes( type );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:EntityBindingContext.java

示例4: resolveMemberTypes

import com.fasterxml.classmate.ResolvedTypeWithMembers; //导入依赖的package包/类
@Override
public ResolvedTypeWithMembers resolveMemberTypes(ResolvedType type) {
	// todo : is there a reason we create this resolver every time?
	MemberResolver memberResolver = new MemberResolver( typeResolver );
	return memberResolver.resolve( type, null, null );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:AnnotationBindingContextImpl.java

示例5: enrich

import com.fasterxml.classmate.ResolvedTypeWithMembers; //导入依赖的package包/类
public void enrich(ApiObjectDoc model) throws ClassNotFoundException {
    if (!model.isPrimitiv()) {
        TypeResolver typeResolver = new TypeResolver();
        ResolvedType resolvedType = typeResolver.resolve(Class.forName(model.getModelClass(), true, Thread.currentThread()
                .getContextClassLoader()));
        SerializationConfig serializationConfig = objectMapper.getSerializationConfig();
        BeanDescription beanDescription = serializationConfig.introspect(TypeFactory.defaultInstance()
                .constructType(resolvedType.getErasedType()));

        MemberResolver memberResolver = new MemberResolver(typeResolver);
        ResolvedTypeWithMembers resolvedMemberWithMembers;
        try {
           resolvedMemberWithMembers = memberResolver.resolve(resolvedType, null, null);
        }
        catch (ArrayIndexOutOfBoundsException aioobex) {
            // TODO this is to avoid an AIOOBEX in memberResolver, should this get fixed upstream?
            return;
        }

        Map<String, BeanPropertyDefinition> propertyLookup = uniqueIndex(beanDescription.findProperties(), beanPropertyByInternalName());

        ClassDescription classDescription = apiDescriptionFinder.getClassDescription(model.getModelClass());
        for (ResolvedField childField : resolvedMemberWithMembers.getMemberFields()) {
            if (propertyLookup.containsKey(childField.getName())) {
                BeanPropertyDefinition propertyDefinition = propertyLookup.get(childField.getName());
                AnnotatedMember member = propertyDefinition.getField();
                if (member != null && member.getMember() != null && Field.class.isAssignableFrom(member.getMember().getClass())) {
                    ApiObjectFieldDoc apiField = new ApiObjectFieldDoc();

                    apiField.setName(propertyDefinition.getName());
                    apiField.setType(propertyDefinition.getField().getRawType().getSimpleName());
                    apiField.setDescription(apiDescriptionFinder.getFieldDescription(classDescription, propertyDefinition.getName()));
                    apiField.setAnnotations(apiDescriptionFinder.getFieldAnnotations(classDescription, propertyDefinition.getName()));

                    if (Collection.class.isAssignableFrom(propertyDefinition.getField().getRawType())) {
                        apiField.setMultiple(true);
                        if (propertyDefinition.getField().getGenericType() instanceof ParameterizedType) {
                            Class<?> c = (Class<?>) ((ParameterizedType) propertyDefinition.getField().getGenericType()).getActualTypeArguments()[0];
                            apiField.setType(c.getSimpleName());
                        }
                    }
                    model.addField(apiField);
                }
            }
        }
    }
}
 
开发者ID:mvb-online,项目名称:restapi-doc,代码行数:48,代码来源:Jackson2ApiObjectDoc.java

示例6: resolveMemberTypes

import com.fasterxml.classmate.ResolvedTypeWithMembers; //导入依赖的package包/类
ResolvedTypeWithMembers resolveMemberTypes(ResolvedType type); 
开发者ID:lamsfoundation,项目名称:lams,代码行数:2,代码来源:AnnotationBindingContext.java


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