本文整理了Java中org.springframework.core.ResolvableType.getSource
方法的一些代码示例,展示了ResolvableType.getSource
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResolvableType.getSource
方法的具体详情如下:
包路径:org.springframework.core.ResolvableType
类名称:ResolvableType
方法名:getSource
[英]Return the underlying source of the resolvable type. Will return a Field, MethodParameter or Type depending on how the ResolvableTypewas constructed. With the exception of the #NONE constant, this method will never return null. This method is primarily to provide access to additional type information or meta-data that alternative JVM languages may provide.
[中]返回可解析类型的基础源。将根据ResolvableType的构造方式返回字段、方法参数或类型。除了#NONE常量之外,此方法永远不会返回null。这种方法主要是提供对其他JVM语言可能提供的额外类型信息或元数据的访问。
代码示例来源:origin: spring-projects/spring-framework
/**
* Return the underlying source of the descriptor. Will return a {@link Field},
* {@link MethodParameter} or {@link Type} depending on how the {@link TypeDescriptor}
* was constructed. This method is primarily to provide access to additional
* type information or meta-data that alternative JVM languages may provide.
* @since 4.0
*/
public Object getSource() {
return this.resolvableType.getSource();
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Return the {@link MethodParameter} from which {@link #getReturnType()
* returnType} was created.
*/
public MethodParameter getReturnTypeSource() {
return (MethodParameter) this.returnType.getSource();
}
代码示例来源:origin: spring-projects/spring-framework
@Nullable
protected MethodParameter getParameter(ResolvableType type) {
return type.getSource() instanceof MethodParameter ? (MethodParameter) type.getSource() : null;
}
代码示例来源:origin: org.springframework/spring-core
/**
* Return the underlying source of the descriptor. Will return a {@link Field},
* {@link MethodParameter} or {@link Type} depending on how the {@link TypeDescriptor}
* was constructed. This method is primarily to provide access to additional
* type information or meta-data that alternative JVM languages may provide.
* @since 4.0
*/
public Object getSource() {
return this.resolvableType.getSource();
}
代码示例来源:origin: org.springframework/spring-web
@Nullable
protected MethodParameter getParameter(ResolvableType type) {
return type.getSource() instanceof MethodParameter ? (MethodParameter) type.getSource() : null;
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void getSource() throws Exception {
Class<?> classType = MySimpleInterfaceType.class;
Field basicField = Fields.class.getField("classType");
Field field = Fields.class.getField("charSequenceList");
Method method = Methods.class.getMethod("charSequenceParameter", List.class);
MethodParameter methodParameter = MethodParameter.forExecutable(method, 0);
assertThat(ResolvableType.forField(basicField).getSource(), equalTo((Object) basicField));
assertThat(ResolvableType.forField(field).getSource(), equalTo((Object) field));
assertThat(ResolvableType.forMethodParameter(methodParameter).getSource(), equalTo((Object) methodParameter));
assertThat(ResolvableType.forMethodParameter(method, 0).getSource(), equalTo((Object) methodParameter));
assertThat(ResolvableType.forClass(classType).getSource(), equalTo((Object) classType));
assertThat(ResolvableType.forClass(classType).getSuperType().getSource(), equalTo((Object) classType.getGenericSuperclass()));
}
代码示例来源:origin: spring-projects/spring-framework
@Test // SPR-16210
public void forMethodParameterWithSameSignatureAndGenerics() throws Exception {
Method method = Methods.class.getMethod("list1");
MethodParameter methodParameter = MethodParameter.forExecutable(method, -1);
ResolvableType type = ResolvableType.forMethodParameter(methodParameter);
assertThat(((MethodParameter)type.getSource()).getMethod(), equalTo(method));
method = Methods.class.getMethod("list2");
methodParameter = MethodParameter.forExecutable(method, -1);
type = ResolvableType.forMethodParameter(methodParameter);
assertThat(((MethodParameter)type.getSource()).getMethod(), equalTo(method));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void forPrivateField() throws Exception {
Field field = Fields.class.getDeclaredField("privateField");
ResolvableType type = ResolvableType.forField(field);
assertThat(type.getType(), equalTo(field.getGenericType()));
assertThat(type.resolve(), equalTo((Class) List.class));
assertThat(type.getSource(), sameInstance(field));
Field field2 = Fields.class.getDeclaredField("otherPrivateField");
ResolvableType type2 = ResolvableType.forField(field2);
assertThat(type2.getType(), equalTo(field2.getGenericType()));
assertThat(type2.resolve(), equalTo((Class) List.class));
assertThat(type2.getSource(), sameInstance(field2));
assertEquals(type, type2);
assertEquals(type.hashCode(), type2.hashCode());
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Return the underlying source of the descriptor. Will return a {@link Field},
* {@link MethodParameter} or {@link Type} depending on how the {@link TypeDescriptor}
* was constructed. This method is primarily to provide access to additional
* type information or meta-data that alternative JVM languages may provide.
* @since 4.0
*/
public Object getSource() {
return this.resolvableType.getSource();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core
/**
* Return the underlying source of the descriptor. Will return a {@link Field},
* {@link MethodParameter} or {@link Type} depending on how the {@link TypeDescriptor}
* was constructed. This method is primarily to provide access to additional
* type information or meta-data that alternative JVM languages may provide.
* @since 4.0
*/
public Object getSource() {
return this.resolvableType.getSource();
}
代码示例来源:origin: org.springframework/spring-web-reactive
/**
* Return the {@link MethodParameter} from which
* {@link #getReturnType() returnType} was created.
*/
public MethodParameter getReturnTypeSource() {
return (MethodParameter) this.returnType.getSource();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web
@Nullable
protected MethodParameter getParameter(ResolvableType type) {
return type.getSource() instanceof MethodParameter ? (MethodParameter) type.getSource() : null;
}
代码示例来源:origin: apache/servicemix-bundles
@Nullable
protected MethodParameter getParameter(ResolvableType type) {
return type.getSource() instanceof MethodParameter ? (MethodParameter) type.getSource() : null;
}
内容来源于网络,如有侵权,请联系作者删除!