public static Class<?> getInjectionTargetPropertyType(ClassLoader cl, InjectionTarget injectionTarget) { AccessibleObject accessibleObject = InjectionTargetUtil.findInjectionTarget(cl, injectionTarget); if (accessibleObject instanceof Field) { return ((Field) accessibleObject).getType(); } else if (accessibleObject instanceof Method) { return ((Method) accessibleObject).getParameterTypes()[0]; } return null; }
public static Class<?> getInjectionTargetPropertyType(ClassLoader cl, JavaEEResourceType javaeeResource) { Collection<InjectionTarget> injectionTargets = javaeeResource.getInjectionTargets(); if (injectionTargets == null || injectionTargets.isEmpty()) { return null; } InjectionTarget injectionTarget = injectionTargets.iterator().next(); Class<?> type = InjectionTargetUtil.getInjectionTargetPropertyType(cl, injectionTarget); return type; } }
public static String getENCName(EnvironmentEntryType environmentEntry) { if (environmentEntry == null || environmentEntry.getName() == null) { return null; } String refName = environmentEntry.getName(); return getENCName(refName); }
/** * Returns the res-env-ref-type for the passed {@link ResourceEnvRefType}. * <p> * If the passed resource-env-ref has the res-type explicitly specified, then * that value is returned. Else, this method checks for the presence of any * injection targets for this resource-env-ref. If there's a injection target, then * the res-env-ref-type is deduced based on the field/method of the injection target. * </p> * <p> * This method returns null if the res-env-ref-type isn't explicitly specified and * if the res-type could not be deduced from the injection targets of this * resource-env-ref. * </p> * * @param cl The {@link ClassLoader} to be used during processing the metadata * @param resourceEnvRef The Java EE resource-env-ref * @return */ private String getResourceEnvRefType(ClassLoader cl, ResourceEnvRefType resourceEnvRef) { // first check whether the type is explicitly specified String explicitType = resourceEnvRef.getResourceType(); if (explicitType != null && !explicitType.isEmpty()) { return explicitType; } Class<?> type = InjectionTargetUtil.getInjectionTargetPropertyType(cl, resourceEnvRef); return type == null ? null : type.getName(); }
/** * Returns the res-type for the passed {@link ResourceRefType}. * <p> * If the passed resource-ref has the res-type explicitly specified, then * that value is returned. Else, this method checks for the presence of any * injection targets for this resource-ref. If there's a injection target, then * the res-type is deduced based on the field/method of the injection target. * </p> * <p> * This method returns null if the res-type isn't explicitly specified and * if the res-type could not be deduced from the injection targets of this * resource-ref. * </p> * * @param cl The {@link ClassLoader} to be used during processing the metadata * @param resourceRef The Java EE resource-ref * @return */ private String getResourceRefType(ClassLoader cl, ResourceRefType resourceRef) { // first check whether the type is explicitly specified String explicitType = resourceRef.getResourceType(); if (explicitType != null && !explicitType.isEmpty()) { return explicitType; } Class<?> type = InjectionTargetUtil.getInjectionTargetPropertyType(cl, resourceRef); return type == null ? null : type.getName(); }
/** * Returns the resource-env-ref-type for the passed {@link ResourceEnvRefType}. * <p> * If the passed resource-env-ref has the resource-env-ref-type explicitly specified, then * that value is returned. Else, this method checks for the presence of any * injection targets for this resource-env-ref. If there's a injection target, then * the resource-env-ref-type is deduced based on the field/method of the injection target. * </p> * <p> * This method returns null if the res-type isn't explicitly specified and * if the resource-env-ref-type could not be deduced from the injection targets of this * resource-env-ref. * </p> * * @param cl The {@link ClassLoader} to be used during processing the metadata * @param resourceEnvRef The Java EE resource-env-ref * @return */ private String getResourceEnvRefType(ClassLoader cl, ResourceEnvRefType resourceEnvRef) { // first check whether the type is explicitly specified String explicitType = resourceEnvRef.getResourceType(); if (explicitType != null && !explicitType.isEmpty()) { return explicitType; } Class<?> type = InjectionTargetUtil.getInjectionTargetPropertyType(cl, resourceEnvRef); return type == null ? null : type.getName(); }
/** * Returns the res-type for the passed {@link ResourceRefType}. * <p> * If the passed resource-ref has the res-type explicitly specified, then * that value is returned. Else, this method checks for the presence of any * injection targets for this resource-ref. If there's a injection target, then * the res-type is deduced based on the field/method of the injection target. * </p> * <p> * This method returns null if the res-type isn't explicitly specified and * if the res-type could not be deduced from the injection targets of this * resource-ref. * </p> * * @param cl The {@link ClassLoader} to be used during processing the metadata * @param resourceRef The Java EE resource-ref * @return */ private String getResourceRefType(ClassLoader cl, ResourceRefType resourceRef) { // first check whether the type is explicitly specified String explicitType = resourceRef.getResourceType(); if (explicitType != null && !explicitType.isEmpty()) { return explicitType; } Class<?> type = InjectionTargetUtil.getInjectionTargetPropertyType(cl, resourceRef); return type == null ? null : type.getName(); }
/** * Returns the res-type for the passed {@link ResourceRefType}. * <p> * If the passed resource-ref has the res-type explicitly specified, then * that value is returned. Else, this method checks for the presence of any * injection targets for this resource-ref. If there's a injection target, then * the res-type is deduced based on the field/method of the injection target. * </p> * <p> * This method returns null if the res-type isn't explicitly specified and * if the res-type could not be deduced from the injection targets of this * resource-ref. * </p> * * @param cl The {@link ClassLoader} to be used during processing the metadata * @param resourceRef The Java EE resource-ref * @return */ private String getResourceRefType(ClassLoader cl, ResourceRefType resourceRef) { // first check whether the type is explicitly specified String explicitType = resourceRef.getResourceType(); if (explicitType != null && !explicitType.isEmpty()) { return explicitType; } Class<?> type = InjectionTargetUtil.getInjectionTargetPropertyType(cl, resourceRef); return type == null ? null : type.getName(); } }
Class<?> type = InjectionTargetUtil.getInjectionTargetPropertyType(cl, injectionTarget); return type;