當前位置: 首頁>>代碼示例>>Java>>正文


Java EJB.beanName方法代碼示例

本文整理匯總了Java中javax.ejb.EJB.beanName方法的典型用法代碼示例。如果您正苦於以下問題:Java EJB.beanName方法的具體用法?Java EJB.beanName怎麽用?Java EJB.beanName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.ejb.EJB的用法示例。


在下文中一共展示了EJB.beanName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: EjbRefElement

import javax.ejb.EJB; //導入方法依賴的package包/類
public EjbRefElement(Member member, PropertyDescriptor pd) {
	super(member, pd);
	AnnotatedElement ae = (AnnotatedElement) member;
	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 (resourceType != null && !Object.class.equals(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();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:27,代碼來源:CommonAnnotationBeanPostProcessor.java

示例2: EjbRefElement

import javax.ejb.EJB; //導入方法依賴的package包/類
public EjbRefElement(Member member, AnnotatedElement ae, 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 (resourceType != null && 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();
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:26,代碼來源:CommonAnnotationBeanPostProcessor.java

示例3: cacheInjectFields

import javax.ejb.EJB; //導入方法依賴的package包/類
/**
 * Caches {@link EJB} annotated fields
 *
 * @param beanClass
 */
private void cacheInjectFields(Field field) {

    EJB ejb = field.getAnnotation(EJB.class);
    Class<?> interfaceClass = ejb.beanInterface();
    if (interfaceClass == null || interfaceClass.equals(Object.class)) {
        interfaceClass = field.getType();
    }

    String name = ejb.beanName();
    if (name == null || name.isEmpty()) {
        name = BeanUtils.nameFromInterface(interfaceClass);
    }

    String description = ejb.description();
    String mappedName = ejb.mappedName();
    Class<?>[] interfaceClasses = { interfaceClass };
    InjectionData injectionData = new InjectionData();
    injectionData.setField(field);
    injectionData.setInterfaceClasses(interfaceClasses);
    injectionData.setName(name);
    injectionData.setDescription(description);
    injectionData.setMappedName(mappedName);
    metaData.addInject(injectionData);
}
 
開發者ID:levants,項目名稱:lightmare,代碼行數:30,代碼來源:BeanDeployer.java

示例4: resolveComponentName

import javax.ejb.EJB; //導入方法依賴的package包/類
/**
 * フィールドからコンポーネントの名前を解決します.
 *
 * @param filed
 *            フィールド
 * @return コンポーネント名
 */
private String resolveComponentName(final Field filed) {
    if (_testContext.isEjb3Enabled()) {
        final EJB ejb = filed.getAnnotation(EJB.class);
        if (ejb != null) {
            if (!StringUtil.isEmpty(ejb.beanName())) {
                return ejb.beanName();
            } else if (!StringUtil.isEmpty(ejb.name())) {
                return ejb.name();
            }
        }
    }
    return normalizeName(filed.getName());
}
 
開發者ID:e-taka,項目名稱:junit-seasar2,代碼行數:21,代碼來源:FieldsBindingStatement.java


注:本文中的javax.ejb.EJB.beanName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。