本文整理汇总了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();
}
示例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 );
}
}
}
}
示例3: resolveMemberTypes
import com.fasterxml.classmate.ResolvedTypeWithMembers; //导入依赖的package包/类
@Override
public ResolvedTypeWithMembers resolveMemberTypes(ResolvedType type) {
return contextDelegate.resolveMemberTypes( type );
}
示例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 );
}
示例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);
}
}
}
}
}
示例6: resolveMemberTypes
import com.fasterxml.classmate.ResolvedTypeWithMembers; //导入依赖的package包/类
ResolvedTypeWithMembers resolveMemberTypes(ResolvedType type);