本文整理了Java中java.lang.reflect.Member.getName()
方法的一些代码示例,展示了Member.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Member.getName()
方法的具体详情如下:
包路径:java.lang.reflect.Member
类名称:Member
方法名:getName
[英]Returns the name of this member.
[中]返回此成员的名称。
代码示例来源:origin: google/guava
@Override
public final String getName() {
return member.getName();
}
代码示例来源:origin: prestodb/presto
@Override
public final String getName() {
return member.getName();
}
代码示例来源:origin: google/j2objc
@Override
public final String getName() {
return member.getName();
}
代码示例来源:origin: google/j2objc
public String getName() {
return member.getName();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public int hashCode() {
return this.member.getClass().hashCode() * 29 + this.member.getName().hashCode();
}
代码示例来源:origin: JakeWharton/butterknife
private static <T extends AccessibleObject & Member> void validateMember(T object) {
int modifiers = object.getModifiers();
if ((modifiers & (PRIVATE | STATIC)) != 0) {
throw new IllegalStateException(object.getDeclaringClass().getName()
+ "."
+ object.getName()
+ " must not be private or static");
}
if ((modifiers & PUBLIC) == 0) {
object.setAccessible(true);
}
}
代码示例来源:origin: hibernate/hibernate-orm
public String determineMemberDescription(Member member) {
return member.getDeclaringClass().getName() + '#' + member.getName();
}
代码示例来源:origin: org.springframework/spring-beans
@Override
public int hashCode() {
return this.member.getClass().hashCode() * 29 + this.member.getName().hashCode();
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Used by JDK serialization...
*
* @param oos The output stream to which we are being written...
* @throws IOException Indicates a general IO stream exception
*/
protected void writeObject(ObjectOutputStream oos) throws IOException {
oos.defaultWriteObject();
oos.writeObject( getJavaMember().getDeclaringClass().getName() );
oos.writeObject( getJavaMember().getName() );
// should only ever be a field or the getter-method...
oos.writeObject( Method.class.isInstance( getJavaMember() ) ? "method" : "field" );
}
}
代码示例来源:origin: spring-projects/spring-framework
public static Signature getSignature(Member member) {
if (member instanceof Method) {
return new Signature(member.getName(), Type.getMethodDescriptor((Method) member));
}
else if (member instanceof Constructor) {
Type[] types = TypeUtils.getTypes(((Constructor) member).getParameterTypes());
return new Signature(Constants.CONSTRUCTOR_NAME,
Type.getMethodDescriptor(Type.VOID_TYPE, types));
}
else {
throw new IllegalArgumentException("Cannot get signature of a field");
}
}
代码示例来源:origin: spring-projects/spring-framework
public EjbRefElement(Member member, AnnotatedElement ae, @Nullable PropertyDescriptor pd) {
super(member, pd);
EJB resource = ae.getAnnotation(EJB.class);
String resourceBeanName = resource.beanName();
String resourceName = resource.name();
this.isDefaultName = !StringUtils.hasLength(resourceName);
if (this.isDefaultName) {
resourceName = this.member.getName();
if (this.member instanceof Method && resourceName.startsWith("set") && resourceName.length() > 3) {
resourceName = Introspector.decapitalize(resourceName.substring(3));
}
}
Class<?> resourceType = resource.beanInterface();
if (Object.class != resourceType) {
checkResourceType(resourceType);
}
else {
// No resource type specified... check field/method.
resourceType = getResourceType();
}
this.beanName = resourceBeanName;
this.name = resourceName;
this.lookupType = resourceType;
this.mappedName = resource.mappedName();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void generateCode(String propertyName, MethodVisitor mv, CodeFlow cf) {
boolean isStatic = Modifier.isStatic(this.member.getModifiers());
String descriptor = cf.lastDescriptor();
String classDesc = this.member.getDeclaringClass().getName().replace('.', '/');
if (!isStatic) {
if (descriptor == null) {
cf.loadTarget(mv);
}
if (descriptor == null || !classDesc.equals(descriptor.substring(1))) {
mv.visitTypeInsn(CHECKCAST, classDesc);
}
}
else {
if (descriptor != null) {
// A static field/method call will not consume what is on the stack,
// it needs to be popped off.
mv.visitInsn(POP);
}
}
if (this.member instanceof Method) {
mv.visitMethodInsn((isStatic ? INVOKESTATIC : INVOKEVIRTUAL), classDesc, this.member.getName(),
CodeFlow.createSignatureDescriptor((Method) this.member), false);
}
else {
mv.visitFieldInsn((isStatic ? GETSTATIC : GETFIELD), classDesc, this.member.getName(),
CodeFlow.toJvmDescriptor(((Field) this.member).getType()));
}
}
}
代码示例来源:origin: spring-projects/spring-framework
public WebServiceRefElement(Member member, AnnotatedElement ae, @Nullable PropertyDescriptor pd) {
super(member, pd);
WebServiceRef resource = ae.getAnnotation(WebServiceRef.class);
String resourceName = resource.name();
Class<?> resourceType = resource.type();
this.isDefaultName = !StringUtils.hasLength(resourceName);
if (this.isDefaultName) {
resourceName = this.member.getName();
if (this.member instanceof Method && resourceName.startsWith("set") && resourceName.length() > 3) {
resourceName = Introspector.decapitalize(resourceName.substring(3));
}
}
if (Object.class != resourceType) {
checkResourceType(resourceType);
}
else {
// No resource type specified... check field/method.
resourceType = getResourceType();
}
this.name = resourceName;
this.elementType = resourceType;
if (Service.class.isAssignableFrom(resourceType)) {
this.lookupType = resourceType;
}
else {
this.lookupType = resource.value();
}
this.mappedName = resource.mappedName();
this.wsdlLocation = resource.wsdlLocation();
}
代码示例来源:origin: spring-projects/spring-framework
public ResourceElement(Member member, AnnotatedElement ae, @Nullable PropertyDescriptor pd) {
super(member, pd);
Resource resource = ae.getAnnotation(Resource.class);
String resourceName = resource.name();
Class<?> resourceType = resource.type();
this.isDefaultName = !StringUtils.hasLength(resourceName);
if (this.isDefaultName) {
resourceName = this.member.getName();
if (this.member instanceof Method && resourceName.startsWith("set") && resourceName.length() > 3) {
resourceName = Introspector.decapitalize(resourceName.substring(3));
}
}
else if (embeddedValueResolver != null) {
resourceName = embeddedValueResolver.resolveStringValue(resourceName);
}
if (Object.class != resourceType) {
checkResourceType(resourceType);
}
else {
// No resource type specified... check field/method.
resourceType = getResourceType();
}
this.name = (resourceName != null ? resourceName : "");
this.lookupType = resourceType;
String lookupValue = resource.lookup();
this.mappedName = (StringUtils.hasLength(lookupValue) ? lookupValue : resource.mappedName());
Lazy lazy = ae.getAnnotation(Lazy.class);
this.lazyLookup = (lazy != null && lazy.value());
}
代码示例来源:origin: spring-projects/spring-framework
@Bean @Scope("prototype")
public TestBean adaptive2(DependencyDescriptor dd) {
return new TestBean(dd.getMember().getName());
}
}
代码示例来源:origin: spring-projects/spring-framework
@Bean @Scope("prototype")
public TestBean adaptive1(InjectionPoint ip) {
return new TestBean(ip.getMember().getName());
}
代码示例来源:origin: google/j2objc
public static Signature getSignature(Member member) {
if (member instanceof Method) {
return new Signature(member.getName(), Type.getMethodDescriptor((Method)member));
} else if (member instanceof Constructor) {
Type[] types = TypeUtils.getTypes(((Constructor)member).getParameterTypes());
return new Signature(Constants.CONSTRUCTOR_NAME,
Type.getMethodDescriptor(Type.VOID_TYPE, types));
} else {
throw new IllegalArgumentException("Cannot get signature of a field");
}
}
代码示例来源:origin: org.springframework/spring-core
public static Signature getSignature(Member member) {
if (member instanceof Method) {
return new Signature(member.getName(), Type.getMethodDescriptor((Method) member));
}
else if (member instanceof Constructor) {
Type[] types = TypeUtils.getTypes(((Constructor) member).getParameterTypes());
return new Signature(Constants.CONSTRUCTOR_NAME,
Type.getMethodDescriptor(Type.VOID_TYPE, types));
}
else {
throw new IllegalArgumentException("Cannot get signature of a field");
}
}
代码示例来源:origin: org.easymock/easymock
public static Signature getSignature(Member member) {
if (member instanceof Method) {
return new Signature(member.getName(), Type.getMethodDescriptor((Method)member));
} else if (member instanceof Constructor) {
Type[] types = TypeUtils.getTypes(((Constructor)member).getParameterTypes());
return new Signature(Constants.CONSTRUCTOR_NAME,
Type.getMethodDescriptor(Type.VOID_TYPE, types));
} else {
throw new IllegalArgumentException("Cannot get signature of a field");
}
}
代码示例来源:origin: cglib/cglib
public static Signature getSignature(Member member) {
if (member instanceof Method) {
return new Signature(member.getName(), Type.getMethodDescriptor((Method)member));
} else if (member instanceof Constructor) {
Type[] types = TypeUtils.getTypes(((Constructor)member).getParameterTypes());
return new Signature(Constants.CONSTRUCTOR_NAME,
Type.getMethodDescriptor(Type.VOID_TYPE, types));
} else {
throw new IllegalArgumentException("Cannot get signature of a field");
}
}
内容来源于网络,如有侵权,请联系作者删除!