本文整理汇总了Java中javax.annotation.Resource.mappedName方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.mappedName方法的具体用法?Java Resource.mappedName怎么用?Java Resource.mappedName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.annotation.Resource
的用法示例。
在下文中一共展示了Resource.mappedName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResourceName
import javax.annotation.Resource; //导入方法依赖的package包/类
private String getResourceName(InjectionPoint injectionPoint) {
Resource resource = getResourceAnnotation(injectionPoint);
String mappedName = resource.mappedName();
if (!mappedName.equals("")) {
return mappedName;
}
String name = resource.name();
if (!name.equals("")) {
return RESOURCE_LOOKUP_PREFIX + "/" + name;
}
String propertyName;
if (injectionPoint.getMember() instanceof Field) {
propertyName = injectionPoint.getMember().getName();
} else if (injectionPoint.getMember() instanceof Method) {
propertyName = getPropertyName((Method) injectionPoint.getMember());
if (propertyName == null) {
throw new IllegalArgumentException("Injection point represents a method which doesn't follow "
+ "JavaBean conventions (unable to determine property name) " + injectionPoint);
}
} else {
throw new AssertionError("Unable to inject into " + injectionPoint);
}
String className = injectionPoint.getMember().getDeclaringClass().getName();
return RESOURCE_LOOKUP_PREFIX + "/" + className + "/" + propertyName;
}
示例2: resolve
import javax.annotation.Resource; //导入方法依赖的package包/类
@Override
public Object resolve(final InjectionPoint injectionPoint) {
final Resource annotation = injectionPoint.getAnnotated().getAnnotation(Resource.class);
if (null == annotation) {
return null;
}
if (Queue.class != injectionPoint.getType()) {
return null;
}
return new TestEEfiQueue(annotation.mappedName());
}
示例3: resolve
import javax.annotation.Resource; //导入方法依赖的package包/类
@Override
public Object resolve(final InjectionPoint injectionPoint) {
final Resource annotation = injectionPoint.getAnnotated().getAnnotation(Resource.class);
if (null == annotation) {
return null;
}
if (Topic.class != injectionPoint.getType()) {
return null;
}
return new TestEEfiTopic(annotation.mappedName());
}
示例4: ResourceElement
import javax.annotation.Resource; //导入方法依赖的package包/类
public ResourceElement(Member member, PropertyDescriptor pd) {
super(member, pd);
AnnotatedElement ae = (AnnotatedElement) member;
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 (beanFactory instanceof ConfigurableBeanFactory){
resourceName = ((ConfigurableBeanFactory) beanFactory).resolveEmbeddedValue(resourceName);
}
if (resourceType != null && !Object.class.equals(resourceType)) {
checkResourceType(resourceType);
}
else {
// No resource type specified... check field/method.
resourceType = getResourceType();
}
this.name = resourceName;
this.lookupType = resourceType;
this.mappedName = resource.mappedName();
}