本文整理了Java中javax.ejb.EJB.name()
方法的一些代码示例,展示了EJB.name()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EJB.name()
方法的具体详情如下:
包路径:javax.ejb.EJB
类名称:EJB
方法名:name
暂无
代码示例来源: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: org.springframework/spring-context
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: net.oneandone/ejb-cdi-unit
String beanNameOrName(EJB ejb) {
if (!ejb.name().isEmpty()) {
return ejb.name();
} else {
return ejb.beanName();
}
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
protected String getEncName(EJB ref, Method method)
{
String encName = ref.name();
if (encName == null || encName.equals(""))
{
encName = InjectionUtil.getEncName(method);
}
else
{
encName = "env/" + encName;
}
return encName;
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-ejb3
protected String getEncName(EJB ref, Field field)
{
String encName = ref.name();
if (encName == null || encName.equals(""))
{
encName = Utils.getEncName(field);
}
else
{
encName = "env/" + encName;
}
return encName;
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-ejb3
protected String getEncName(EJB ref, Method method)
{
String encName = ref.name();
if (encName == null || encName.equals(""))
{
encName = Utils.getEncName(method);
}
else
{
encName = "env/" + encName;
}
return encName;
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
protected String getEncName(EJB ref, Field field)
{
String encName = ref.name();
if (encName == null || encName.equals(""))
{
encName = InjectionUtil.getEncName(field);
}
else
{
encName = "env/" + encName;
}
return encName;
}
代码示例来源:origin: com.sun.faces/jsf-impl
private void applyToMethod(FacesContext facesContext, Method method, EJB ejb, Object instance) {
if (method.getName().startsWith("set")) {
Object value = null;
if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) {
value = lookup(facesContext, ejb.lookup());
} else if (ejb.name() != null && !"".equals(ejb.name().trim())) {
value = lookup(facesContext, JAVA_COMP_ENV + ejb.name());
}
invokeMethod(facesContext, method, instance, value);
}
}
}
代码示例来源:origin: org.glassfish/javax.faces
private void applyToMethod(FacesContext facesContext, Method method, EJB ejb, Object instance) {
if (method.getName().startsWith("set")) {
Object value = null;
if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) {
value = lookup(facesContext, ejb.lookup());
} else if (ejb.name() != null && !"".equals(ejb.name().trim())) {
value = lookup(facesContext, JAVA_COMP_ENV + ejb.name());
}
invokeMethod(facesContext, method, instance, value);
}
}
}
代码示例来源:origin: org.glassfish/jakarta.faces
private void applyToMethod(FacesContext facesContext, Method method, EJB ejb, Object instance) {
if (method.getName().startsWith("set")) {
Object value = null;
if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) {
value = lookup(facesContext, ejb.lookup());
} else if (ejb.name() != null && !"".equals(ejb.name().trim())) {
value = lookup(facesContext, JAVA_COMP_ENV + ejb.name());
}
invokeMethod(facesContext, method, instance, value);
}
}
}
代码示例来源:origin: com.sun.faces/jsf-impl
private void applyToField(FacesContext facesContext, Field field, EJB ejb, Object instance) {
Object value;
if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) {
value = lookup(facesContext, ejb.lookup());
} else if (ejb.name() != null && !"".equals(ejb.name().trim())) {
value = lookup(facesContext, JAVA_COMP_ENV + ejb.name());
} else {
value = lookup(facesContext, JAVA_MODULE + field.getType().getSimpleName());
}
setField(facesContext, field, instance, value);
}
代码示例来源:origin: org.glassfish/javax.faces
private void applyToField(FacesContext facesContext, Field field, EJB ejb, Object instance) {
Object value;
if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) {
value = lookup(facesContext, ejb.lookup());
} else if (ejb.name() != null && !"".equals(ejb.name().trim())) {
value = lookup(facesContext, JAVA_COMP_ENV + ejb.name());
} else {
value = lookup(facesContext, JAVA_MODULE + field.getType().getSimpleName());
}
setField(facesContext, field, instance, value);
}
代码示例来源:origin: org.glassfish/jakarta.faces
private void applyToField(FacesContext facesContext, Field field, EJB ejb, Object instance) {
Object value;
if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) {
value = lookup(facesContext, ejb.lookup());
} else if (ejb.name() != null && !"".equals(ejb.name().trim())) {
value = lookup(facesContext, JAVA_COMP_ENV + ejb.name());
} else {
value = lookup(facesContext, JAVA_MODULE + field.getType().getSimpleName());
}
setField(facesContext, field, instance, value);
}
代码示例来源:origin: org.seasar.container/s2-tiger
/**
* {@link EJB}アノテーションで指定されたセッションビーンを取得するOGNL式を返します。
*
* @param ejb
* {@link EJB}アノテーション
* @return {@link EJB}アノテーションで指定されたセッションビーンを取得するOGNL式
*/
protected String getExpression(final EJB ejb) {
String name = ejb.beanName();
if (StringUtil.isEmpty(name)) {
name = ejb.name();
}
return name.replace('/', '.');
}
}
代码示例来源:origin: org.wicketstuff/javaee-inject
private IProxyTargetLocator getProxyTargetLocator(Field field) {
if (field.isAnnotationPresent(EJB.class)) {
return new JavaEEBeanLocator(field.getAnnotation(EJB.class).name(),
field.getType(), namingStrategy);
}
if (field.isAnnotationPresent(PersistenceUnit.class)) {
return new EntityManagerFactoryLocator(field.getAnnotation(PersistenceUnit.class).unitName());
}
if (field.isAnnotationPresent(Resource.class)) {
return new JndiObjectLocator(field.getAnnotation(Resource.class).name(), field.getType());
}
// else
return null;
}
}
代码示例来源:origin: org.ow2.jonas/jonas-webservices-jaxws-core
private String getNameFromAnnotation(Annotation annotation) {
String name = null;
if (annotation instanceof Resource) {
name = ((Resource) annotation).name();
} else if (annotation instanceof EJB) {
name = ((EJB) annotation).name();
} else if (annotation instanceof PersistenceUnit) {
name = ((PersistenceUnit) annotation).name();
} else if (annotation instanceof PersistenceContext) {
name = ((PersistenceContext) annotation).name();
}
return name;
}
}
代码示例来源:origin: com.caucho/resin
private void introspectClass(String location, EJB ejb)
{
String name = ejb.name();
Class<?> bindType = ejb.beanInterface();
if ("".equals(name))
throw new ConfigException(L.l("{0}: @EJB name() attribute is required for @EJB on a class.",
location));
if (Object.class.equals(bindType))
throw new ConfigException(L.l("{0}: @EJB beanInterface() attribute is required for @EJB on a class.",
location));
ValueGenerator gen = bindGenerator(location, ejb, bindType);
if (name != null && ! "".equals(name)) {
bindJndi(name, gen, name);
}
}
代码示例来源:origin: com.caucho/resin
private ConfigProgram generateContext(AnnotatedField<?> field,
EJB ejb)
throws ConfigException
{
String name = ejb.name();
Field javaField = field.getJavaMember();
String location = getLocation(javaField);
Class<?> bindType = javaField.getType();
ValueGenerator gen = bindGenerator(location, ejb, bindType);
if (name != null && ! "".equals(name))
bindJndi(name, gen, name);
bindJndi(javaField, gen);
return new FieldGeneratorProgram(javaField, gen);
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
protected void handleClassAnnotation(EJB ejb, Class<?> clazz, InjectionContainer container)
{
String encName = ejb.name();
if (encName == null || encName.equals(""))
{
throw new RuntimeException("JBoss requires the name of the @EJB in the @EJBs: " + clazz);
}
encName = "env/" + encName;
if (container.getEncInjectors().containsKey(encName)) return;
ejbRefEncInjector(ejb.mappedName(), encName, null, ejb.beanInterface(), ejb.beanName(), "@EJB", container);
// handle dependencies
if (isIgnoreDependency(container, ejb))
log.debug("IGNORING <ejb-ref> DEPENDENCY: " + encName);
else
ejbRefDependency(ejb.mappedName(), ejb.beanName(), container, ejb.beanInterface(), "@EJB", encName);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-tomcat
protected void handleClassAnnotation(EJB ejb, Class<?> clazz, InjectionContainer container)
{
String encName = ejb.name();
if (encName == null || encName.equals(""))
{
throw new RuntimeException("JBoss requires the name of the @EJB in the @EJBs: " + clazz);
}
encName = "env/" + encName;
if (container.getEncInjectors().containsKey(encName)) return;
ejbRefEncInjector(ejb.mappedName(), encName, null, ejb.beanInterface(), ejb.beanName(), "@EJB", container);
// handle dependencies
if (isIgnoreDependency(container, ejb))
log.debug("IGNORING <ejb-ref> DEPENDENCY: " + encName);
else
ejbRefDependency(ejb.mappedName(), ejb.beanName(), container, ejb.beanInterface(), "@EJB", encName);
}
内容来源于网络,如有侵权,请联系作者删除!