本文整理了Java中javax.annotation.Resource.name
方法的一些代码示例,展示了Resource.name
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.name
方法的具体详情如下:
包路径:javax.annotation.Resource
类名称:Resource
方法名:name
暂无
代码示例来源: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: org.springframework/spring-context
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: xuxueli/xxl-job
try {
Resource resource = AnnotationUtils.getAnnotation(field, Resource.class);
if (resource.name()!=null && resource.name().length()>0){
fieldBean = XxlJobSpringExecutor.getApplicationContext().getBean(resource.name());
} else {
fieldBean = XxlJobSpringExecutor.getApplicationContext().getBean(field.getName());
代码示例来源:origin: wildfly/wildfly
return mappedName;
String name = resource.name();
if (!name.equals("")) {
代码示例来源:origin: paoding-code/paoding-rose
beanName = clazz.getAnnotation(Resource.class).name();
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
private static String getName(Resource annotation, String defaultName) {
String name = annotation.name();
if (name == null || name.equals("")) {
if (defaultName != null) {
name = defaultName;
}
}
return name;
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
private static String getName(Resource annotation, String defaultName) {
String name = annotation.name();
if (name == null || name.equals("")) {
if (defaultName != null) {
name = defaultName;
}
}
return name;
}
}
代码示例来源:origin: apache/cxf
private String getFieldNameForResource(Resource res, Field field) {
assert res != null;
if (res.name() == null || "".equals(res.name())) {
return field.getDeclaringClass().getCanonicalName() + "/" + field.getName();
}
return res.name();
}
代码示例来源:origin: org.apache.cxf/cxf-api
private String getFieldNameForResource(Resource res, Field field) {
assert res != null;
if (res.name() == null || "".equals(res.name())) {
return field.getDeclaringClass().getCanonicalName() + "/" + field.getName();
}
return res.name();
}
代码示例来源:origin: org.apache.cxf/cxf-core
private String getFieldNameForResource(Resource res, Field field) {
assert res != null;
if (res.name() == null || "".equals(res.name())) {
return field.getDeclaringClass().getCanonicalName() + "/" + field.getName();
}
return res.name();
}
代码示例来源:origin: apache/cxf
private String getResourceName(Resource res, Method method) {
assert method != null;
assert res != null;
assert method.getName().startsWith("set") : method;
if (res.name() == null || "".equals(res.name())) {
String name = method.getName().substring(3);
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
return method.getDeclaringClass().getCanonicalName() + "/" + name;
}
return res.name();
}
代码示例来源:origin: org.objectweb.celtix/celtix-common
private String getResourceName(Resource res, Method method) {
assert method != null;
assert res != null;
assert method.getName().startsWith("set") : method;
if (res.name() == null || "".equals(res.name())) {
String name = method.getName();
name = name.substring(3);
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
return name;
}
return res.name();
}
代码示例来源:origin: org.apache.cxf/cxf-common-utilities
private String getResourceName(Resource res, Method method) {
assert method != null;
assert res != null;
assert method.getName().startsWith("set") : method;
if (res.name() == null || "".equals(res.name())) {
String name = method.getName().substring(3);
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
return method.getDeclaringClass().getCanonicalName() + "/" + name;
}
return res.name();
}
代码示例来源:origin: org.apache.cxf/cxf-core
private String getResourceName(Resource res, Method method) {
assert method != null;
assert res != null;
assert method.getName().startsWith("set") : method;
if (res.name() == null || "".equals(res.name())) {
String name = method.getName().substring(3);
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
return method.getDeclaringClass().getCanonicalName() + "/" + name;
}
return res.name();
}
代码示例来源:origin: org.apache.cxf/cxf-api
private String getResourceName(Resource res, Method method) {
assert method != null;
assert res != null;
assert method.getName().startsWith("set") : method;
if (res.name() == null || "".equals(res.name())) {
String name = method.getName().substring(3);
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
return method.getDeclaringClass().getCanonicalName() + "/" + name;
}
return res.name();
}
代码示例来源:origin: org.apache.myfaces.core/myfaces-impl
protected void checkMethodAnnotation(Method method, Object instance)
throws NamingException, IllegalAccessException, InvocationTargetException
{
if (method.isAnnotationPresent(Resource.class))
{
Resource annotation = method.getAnnotation(Resource.class);
lookupMethodResource(context, instance, method, annotation.name());
}
}
代码示例来源:origin: org.apache.myfaces.core/myfaces-impl
protected void checkFieldAnnotation(Field field, Object instance)
throws NamingException, IllegalAccessException
{
if (field.isAnnotationPresent(Resource.class))
{
Resource annotation = field.getAnnotation(Resource.class);
lookupFieldResource(context, instance, field, annotation.name());
}
}
代码示例来源:origin: org.apache.myfaces.core/myfaces-impl
protected void checkMethodAnnotation(Method method, Object instance)
throws NamingException, IllegalAccessException, InvocationTargetException
{
if (method.isAnnotationPresent(Resource.class))
{
Resource annotation = method.getAnnotation(Resource.class);
lookupMethodResource(context, instance, method, annotation.name());
}
}
代码示例来源:origin: stoicflame/enunciate
public String getServiceEndpointId() {
String name = "enunciate:service:" + getSimpleName();
Resource resource = getAnnotation(Resource.class);
if (resource != null && !"".equals(resource.name())) {
name = resource.name();
}
return name;
}
代码示例来源:origin: com.netflix.governator/governator
private void loadClassResource(Resource resource) throws Exception {
if ((resource.name().isEmpty()) || (resource.type() == Object.class)) {
throw new Exception("Class resources must have both name() and type(): " + resource);
}
findResource(resource);
}
内容来源于网络,如有侵权,请联系作者删除!