private String getMessageListenerInterface( final CompositeIndex compositeIndex, final AnnotationInstance messageBeanAnnotation) throws DeploymentUnitProcessingException { final AnnotationValue value = messageBeanAnnotation.value("messageListenerInterface"); if (value != null) return value.asClass().name().toString(); final ClassInfo beanClass = (ClassInfo) messageBeanAnnotation.target(); final Set<DotName> interfaces = new HashSet<DotName>(getPotentialViewInterfaces(beanClass)); // check super class(es) of the bean DotName superClassDotName = beanClass.superName(); while (interfaces.isEmpty() && superClassDotName != null && !superClassDotName.toString().equals(Object.class.getName())) { final ClassInfo superClass = compositeIndex.getClassByName(superClassDotName); if (superClass == null) { break; } interfaces.addAll(getPotentialViewInterfaces(superClass)); // move to next super class superClassDotName = superClass.superName(); } if (interfaces.size() != 1) throw MESSAGES.mdbDoesNotImplementNorSpecifyMessageListener(beanClass); return interfaces.iterator().next().toString(); }
private AnnotationInstance overrideSchemaCatalogByDefault( AnnotationInstance annotationInstance, EntityMappingsMocker.Default defaults) { List<AnnotationValue> newAnnotationValueList = new ArrayList<AnnotationValue>(); newAnnotationValueList.addAll(annotationInstance.values()); boolean schemaDefined = false; boolean catalogDefined = false; if (annotationInstance.value("schema") != null) { schemaDefined = true; } if (annotationInstance.value("catalog") != null) { catalogDefined = true; } if (schemaDefined && catalogDefined) { return annotationInstance; } if (!catalogDefined && StringHelper.isNotEmpty(defaults.getCatalog())) { newAnnotationValueList.add( AnnotationValue.createStringValue("catalog", defaults.getCatalog())); } if (!schemaDefined && StringHelper.isNotEmpty(defaults.getSchema())) { newAnnotationValueList.add(AnnotationValue.createStringValue("schema", defaults.getSchema())); } return MockHelper.create( annotationInstance.name(), annotationInstance.target(), MockHelper.toArray(newAnnotationValueList)); }
/** * Read module info from bytecode. * * @param moduleName the module name * @param jarFile the module jar file * @return module info list */ private static ModuleInfo readModuleInformation( final String moduleName, final File jarFile, Overrides overrides) { Index index = readModuleIndex(jarFile, false); final AnnotationInstance ai = getAnnotation(index, moduleName, MODULE_ANNOTATION); if (ai == null) return null; final AnnotationValue version = ai.value("version"); if (version == null) return null; final AnnotationValue dependencies = ai.value("dependencies"); if (dependencies == null) return new ModuleInfo(null, Collections.<ModuleDependencyInfo>emptySet()); final Set<ModuleDependencyInfo> infos = new LinkedHashSet<ModuleDependencyInfo>(); final AnnotationInstance[] imports = dependencies.asNestedArray(); if (imports != null) { for (AnnotationInstance im : imports) { final String name = asString(im, "name"); final ModuleDependencyInfo mi = new ModuleDependencyInfo( name, asString(im, "version"), asBoolean(im, "optional"), asBoolean(im, "export")); infos.add(mi); } } ModuleInfo ret = new ModuleInfo(null, infos); if (overrides != null) ret = overrides.applyOverrides(moduleName, version.asString(), ret); return ret; }
private BindingDescription processClassResource( final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, final ClassInfo classInfo, final AbstractComponentDescription componentDescription, final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final AnnotationValue nameValue = annotation.value("name"); if (nameValue == null || nameValue.asString().isEmpty()) { throw new IllegalArgumentException("Class level annotations must provide a name."); } final String name = nameValue.asString(); final String type = classInfo.name().toString(); final BindingDescription bindingDescription = new BindingDescription(); bindingDescription.setDependency(true); bindingDescription.setBindingName(name); bindingDescription.setBindingType(type); ServiceName injectorName = getInjectorServiceName( deploymentUnit, annotation, componentDescription, phaseContext, name, type); bindingDescription.setReferenceSourceDescription( new ServiceBindingSourceDescription(injectorName)); return bindingDescription; }
/** * Check the deployment annotation index for all classes with the @ManagedBean annotation. For * each class with the annotation, collect all the required information to create a managed bean * instance, and attach it to the context. * * @param phaseContext the deployment unit context * @throws DeploymentUnitProcessingException */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); final String applicationName = moduleDescription.getAppName(); final CompositeIndex compositeIndex = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX); if (compositeIndex == null) { return; } final List<AnnotationInstance> instances = compositeIndex.getAnnotations(MANAGED_BEAN_ANNOTATION_NAME); if (instances == null || instances.isEmpty()) { return; } for (AnnotationInstance instance : instances) { AnnotationTarget target = instance.target(); if (!(target instanceof ClassInfo)) { throw new DeploymentUnitProcessingException( "The ManagedBean annotation is only allowed at the class level: " + target); } final ClassInfo classInfo = (ClassInfo) target; final String beanClassName = classInfo.name().toString(); // Get the managed bean name from the annotation final AnnotationValue nameValue = instance.value(); final String beanName = nameValue == null || nameValue.asString().isEmpty() ? beanClassName : nameValue.asString(); final ManagedBeanComponentDescription componentDescription = new ManagedBeanComponentDescription( beanName, beanClassName, moduleDescription.getModuleName(), applicationName); final ServiceName baseName = deploymentUnit.getServiceName().append("component").append(beanName); // Add the view componentDescription.getViewClassNames().add(beanClassName); // Bind the view to its two JNDI locations // TODO - this should be a bit more elegant final BindingDescription moduleBinding = new BindingDescription(); moduleBinding.setAbsoluteBinding(true); moduleBinding.setBindingName("java:module/" + beanName); moduleBinding.setBindingType(beanClassName); moduleBinding.setReferenceSourceDescription( new ServiceBindingSourceDescription(baseName.append("VIEW").append(beanClassName))); componentDescription.getBindings().add(moduleBinding); final BindingDescription appBinding = new BindingDescription(); appBinding.setAbsoluteBinding(true); appBinding.setBindingName("java:app/" + moduleDescription.getModuleName() + "/" + beanName); appBinding.setBindingType(beanClassName); appBinding.setReferenceSourceDescription( new ServiceBindingSourceDescription(baseName.append("VIEW").append(beanClassName))); componentDescription.getBindings().add(appBinding); moduleDescription.addComponent(componentDescription); } }
private BindingDescription processMethod( final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, final MethodInfo methodInfo, final AbstractComponentDescription componentDescription, final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final String methodName = methodInfo.name(); if (!methodName.startsWith("set") || methodInfo.args().length != 1) { throw new IllegalArgumentException( "injection target is invalid. Only setter methods are allowed: " + methodInfo); } final String contextNameSuffix = methodName.substring(3, 4).toLowerCase() + methodName.substring(4); final AnnotationValue declaredNameValue = annotation.value("name"); final String declaredName = declaredNameValue != null ? declaredNameValue.asString() : null; final String localContextName; if (declaredName == null || declaredName.isEmpty()) { localContextName = methodInfo.declaringClass().name().toString() + "/" + contextNameSuffix; } else { localContextName = declaredName; } final DotName declaredType = methodInfo.returnType().name(); final DotName injectionType = declaredType == null || declaredType.toString().equals(Object.class.getName()) ? methodInfo.returnType().name() : declaredType; final BindingDescription bindingDescription = new BindingDescription(); bindingDescription.setDependency(true); bindingDescription.setBindingName(localContextName); final String injectionTypeName = injectionType.toString(); bindingDescription.setBindingType(injectionTypeName); ServiceName injectorName = getInjectorServiceName( deploymentUnit, annotation, componentDescription, phaseContext, methodName, injectionTypeName); bindingDescription.setReferenceSourceDescription( new ServiceBindingSourceDescription(injectorName)); // setup the injection target final InjectionTargetDescription targetDescription = new InjectionTargetDescription(); targetDescription.setName(methodName); targetDescription.setClassName(methodInfo.declaringClass().name().toString()); targetDescription.setType(InjectionTargetDescription.Type.METHOD); targetDescription.setValueClassName(injectionTypeName); bindingDescription.getInjectionTargetDescriptions().add(targetDescription); return bindingDescription; }
@Override public void check(AnnotationInstance annotationInstance) { AnnotationValue cascadeValue = annotationInstance.value("cascade"); assertNotNull( "Cascade is null in @OneToMany, but should be added a Cascade persist", cascadeValue); String[] enumArray = cascadeValue.asEnumArray(); assertEquals(expected.length, enumArray.length); assertArrayEquals(expected, enumArray); }
@Override protected AccessTimeoutDetails fromAnnotation( final AnnotationInstance annotationInstance, final PropertyReplacer propertyReplacer) { final long timeout = annotationInstance.value().asLong(); AnnotationValue unitAnnVal = annotationInstance.value("unit"); final TimeUnit unit = unitAnnVal != null ? TimeUnit.valueOf(unitAnnVal.asEnum()) : TimeUnit.MILLISECONDS; return new AccessTimeoutDetails(timeout, unit); }
private BindingDescription processField( final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, final FieldInfo fieldInfo, final AbstractComponentDescription componentDescription, final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final String fieldName = fieldInfo.name(); final AnnotationValue declaredNameValue = annotation.value("name"); final String declaredName = declaredNameValue != null ? declaredNameValue.asString() : null; final String localContextName; if (declaredName == null || declaredName.isEmpty()) { localContextName = "java:comp/env/persistence" + "/" + fieldName; } else { localContextName = declaredName; } // final AnnotationValue declaredTypeValue = annotation.value("type"); final DotName declaredType = fieldInfo.type().name(); final DotName injectionType = declaredType == null || declaredType.toString().equals(Object.class.getName()) ? fieldInfo.type().name() : declaredType; BindingDescription bindingDescription = new BindingDescription(); bindingDescription.setDependency(true); bindingDescription.setBindingName(localContextName); final String injectionTypeName = injectionType.toString(); bindingDescription.setBindingType(injectionTypeName); ServiceName injectorName = getInjectorServiceName( deploymentUnit, annotation, componentDescription, phaseContext, fieldName, injectionTypeName); bindingDescription.setReferenceSourceDescription( new ServiceBindingSourceDescription(injectorName)); // setup the injection target final InjectionTargetDescription targetDescription = new InjectionTargetDescription(); targetDescription.setName(fieldName); targetDescription.setClassName(fieldInfo.declaringClass().name().toString()); targetDescription.setType(InjectionTargetDescription.Type.FIELD); targetDescription.setValueClassName(injectionTypeName); bindingDescription.getInjectionTargetDescriptions().add(targetDescription); return bindingDescription; }
@Override public int[] getBinaryVersions(String moduleName, String moduleVersion, File moduleArchive) { Index index = readModuleIndex(moduleArchive, false); final AnnotationInstance ceylonAnnotation = getAnnotation(index, moduleName, CEYLON_ANNOTATION); if (ceylonAnnotation == null) return null; AnnotationValue majorAnnotation = ceylonAnnotation.value("major"); AnnotationValue minorAnnotation = ceylonAnnotation.value("minor"); int major = majorAnnotation != null ? majorAnnotation.asInt() : 0; int minor = minorAnnotation != null ? minorAnnotation.asInt() : 0; return new int[] {major, minor}; }
public boolean matchesModuleInfo( String moduleName, String moduleVersion, File moduleArchive, String query, Overrides overrides) { Index index = readModuleIndex(moduleArchive, false); final AnnotationInstance moduleAnnotation = getAnnotation(index, moduleName, MODULE_ANNOTATION); if (moduleAnnotation == null) return false; AnnotationValue version = moduleAnnotation.value("version"); if (version == null) return false; AnnotationValue doc = moduleAnnotation.value("doc"); if (doc != null && matches(doc.asString(), query)) return true; AnnotationValue license = moduleAnnotation.value("license"); if (license != null && matches(license.asString(), query)) return true; AnnotationValue by = moduleAnnotation.value("by"); if (by != null) { for (String author : by.asStringArray()) { if (matches(author, query)) return true; } } AnnotationValue dependencies = moduleAnnotation.value("dependencies"); if (dependencies != null) { for (ModuleDependencyInfo dep : getDependencies(dependencies, moduleName, version.asString(), overrides)) { if (matches(dep.getModuleName(), query)) return true; } } return false; }
private Properties getActivationConfigProperties( final AnnotationInstance messageBeanAnnotation, boolean replacement) { final Properties props = new Properties(); final AnnotationValue activationConfig = messageBeanAnnotation.value("activationConfig"); if (activationConfig == null) return props; for (final AnnotationInstance propAnnotation : activationConfig.asNestedArray()) { String propertyName = propAnnotation.value("propertyName").asString(); String propertyValue = propAnnotation.value("propertyValue").asString(); if (replacement) props.put(propertyName, PropertiesValueResolver.replaceProperties(propertyValue)); else props.put(propertyName, propertyValue); } return props; }
private static AnnotationValue classValue( String name, String className, ServiceRegistry serviceRegistry) { if (StringHelper.isNotEmpty(className)) { return AnnotationValue.createClassValue(name, getType(className, serviceRegistry)); } return null; }
/* 91: */ /* 92: */ private static AnnotationValue classValue(String name, String className, ServiceRegistry serviceRegistry) /* 93: */ { /* 94:123 */ if (StringHelper.isNotEmpty(className)) { /* 95:124 */ return AnnotationValue.createClassValue(name, getType(className, serviceRegistry)); /* 96: */ } /* 97:126 */ return null; /* 98: */ }
/* 60: */ /* 61: */ private static AnnotationValue integerValue(String name, Integer value) /* 62: */ { /* 63: 97 */ if (value == null) { /* 64: 98 */ return null; /* 65: */ } /* 66:100 */ return AnnotationValue.createIntegerValue(name, value.intValue()); /* 67: */ }
/* 83: */ /* 84: */ private static AnnotationValue booleanValue(String name, Boolean value) /* 85: */ { /* 86:116 */ if (value == null) { /* 87:117 */ return null; /* 88: */ } /* 89:119 */ return AnnotationValue.createBooleanValue(name, value.booleanValue()); /* 90: */ }
/* 148: */ /* 149: */ private static AnnotationValue enumValue(String name, DotName typeName, Enum value) /* 150: */ { /* 151:182 */ if ((value != null) && (StringHelper.isNotEmpty(value.toString()))) { /* 152:183 */ return AnnotationValue.createEnumValue(name, typeName, value.toString()); /* 153: */ } /* 154:185 */ return null; /* 155: */ }
/* 47: */ /* 48: */ private static AnnotationValue stringValue(String name, String value) /* 49: */ { /* 50: 86 */ if (StringHelper.isNotEmpty(value)) { /* 51: 87 */ return AnnotationValue.createStringValue(name, value); /* 52: */ } /* 53: 89 */ return null; /* 54: */ }
/* 109: */ /* 110: */ static AnnotationValue nestedAnnotationValue(String name, AnnotationInstance value) /* 111: */ { /* 112:139 */ if (value == null) { /* 113:140 */ return null; /* 114: */ } /* 115:142 */ return AnnotationValue.createNestedAnnotationValue(name, value); /* 116: */ }
private void processMethod( final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, final MethodInfo methodInfo, final EEModuleClassDescription eeModuleClassDescription) throws DeploymentUnitProcessingException { final String methodName = methodInfo.name(); if (!methodName.startsWith("set") || methodInfo.args().length != 1) { eeModuleClassDescription.setInvalid( MESSAGES.setterMethodOnlyAnnotation(annotation.name().toString(), methodInfo)); return; } final String contextNameSuffix = methodName.substring(3, 4).toLowerCase() + methodName.substring(4); final AnnotationValue declaredNameValue = annotation.value("name"); final String declaredName = declaredNameValue != null ? declaredNameValue.asString() : null; final String localContextName; if (declaredName == null || declaredName.isEmpty()) { localContextName = methodInfo.declaringClass().name().toString() + "/" + contextNameSuffix; } else { localContextName = declaredName; } final String injectionType = methodInfo.args()[0].name().toString(); final InjectionSource bindingSource = this.getBindingSource(deploymentUnit, annotation, injectionType, eeModuleClassDescription); if (bindingSource != null) { final BindingConfiguration bindingConfiguration = new BindingConfiguration(localContextName, bindingSource); eeModuleClassDescription.getBindingConfigurations().add(bindingConfiguration); // setup the injection configuration final InjectionTarget injectionTarget = new MethodInjectionTarget( methodInfo.declaringClass().name().toString(), methodName, methodInfo.args()[0].name().toString()); // source is always local ENC jndi name final InjectionSource injectionSource = new LookupInjectionSource(localContextName); final ResourceInjectionConfiguration injectionConfiguration = new ResourceInjectionConfiguration(injectionTarget, injectionSource); eeModuleClassDescription.addResourceInjection(injectionConfiguration); } }
private void processField( final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, final FieldInfo fieldInfo, final EEModuleClassDescription eeModuleClassDescription) throws DeploymentUnitProcessingException { final String fieldName = fieldInfo.name(); final AnnotationValue declaredNameValue = annotation.value("name"); final String declaredName = declaredNameValue != null ? declaredNameValue.asString() : null; final String localContextName; if (declaredName == null || declaredName.isEmpty()) { localContextName = fieldInfo.declaringClass().name().toString() + "/" + fieldName; } else { localContextName = declaredName; } // final AnnotationValue declaredTypeValue = annotation.value("type"); final DotName declaredTypeDotName = fieldInfo.type().name(); final DotName injectionTypeDotName = declaredTypeDotName == null || declaredTypeDotName.toString().equals(Object.class.getName()) ? fieldInfo.type().name() : declaredTypeDotName; final String injectionType = injectionTypeDotName.toString(); final InjectionSource bindingSource = this.getBindingSource(deploymentUnit, annotation, injectionType, eeModuleClassDescription); if (bindingSource != null) { final BindingConfiguration bindingConfiguration = new BindingConfiguration(localContextName, bindingSource); eeModuleClassDescription.getBindingConfigurations().add(bindingConfiguration); // setup the injection target final InjectionTarget injectionTarget = new FieldInjectionTarget( fieldInfo.declaringClass().name().toString(), fieldName, fieldInfo.type().name().toString()); // source is always local ENC jndi final InjectionSource injectionSource = new LookupInjectionSource(localContextName); final ResourceInjectionConfiguration injectionConfiguration = new ResourceInjectionConfiguration(injectionTarget, injectionSource); eeModuleClassDescription.addResourceInjection(injectionConfiguration); } }
private String getScopedPuName( final DeploymentUnit deploymentUnit, final AnnotationInstance annotation) throws DeploymentUnitProcessingException { final AnnotationValue puName = annotation.value("unitName"); String scopedPuName; String searchName = null; // note: a null searchName will match the first PU definition found if (puName != null) { searchName = puName.asString(); } scopedPuName = PersistenceUnitSearch.resolvePersistenceUnitSupplier(deploymentUnit, searchName); if (null == scopedPuName) { throw new DeploymentUnitProcessingException( "Can't find a deployment unit named " + puName.asString() + " at " + deploymentUnit); } return scopedPuName; }
@Override public ModuleVersionDetails readModuleInfo( String moduleName, String moduleVersion, File moduleArchive, boolean includeMembers, Overrides overrides) { Index index = readModuleIndex(moduleArchive, true); final AnnotationInstance moduleAnnotation = getAnnotation(index, moduleName, MODULE_ANNOTATION); if (moduleAnnotation == null) return null; AnnotationValue doc = moduleAnnotation.value("doc"); AnnotationValue license = moduleAnnotation.value("license"); AnnotationValue by = moduleAnnotation.value("by"); AnnotationValue dependencies = moduleAnnotation.value("dependencies"); String type = ArtifactContext.getSuffixFromFilename(moduleArchive.getName()); final AnnotationInstance ceylonAnnotation = getAnnotation(index, moduleName, CEYLON_ANNOTATION); if (ceylonAnnotation == null) return null; AnnotationValue majorVer = ceylonAnnotation.value("major"); AnnotationValue minorVer = ceylonAnnotation.value("minor"); ModuleVersionDetails mvd = new ModuleVersionDetails( moduleName, getVersionFromFilename(moduleName, moduleArchive.getName())); mvd.setDoc(doc != null ? doc.asString() : null); mvd.setLicense(license != null ? license.asString() : null); if (by != null) { mvd.getAuthors().addAll(Arrays.asList(by.asStringArray())); } mvd.getDependencies() .addAll(getDependencies(dependencies, moduleName, mvd.getVersion(), overrides)); ModuleVersionArtifact mva = new ModuleVersionArtifact( type, majorVer != null ? majorVer.asInt() : 0, minorVer != null ? minorVer.asInt() : 0); mvd.getArtifactTypes().add(mva); if (includeMembers) { mvd.setMembers(getMembers(index)); } return mvd; }
/** * We need to check whether the is an explicit type specified via {@link * org.hibernate.annotations.Type}. * * @param type the type specified via the constructor * @param typeParameters map for type parameters in case there are any * @return the final type for this mapped attribute */ private String determineType(String type, Map<String, String> typeParameters) { AnnotationInstance typeAnnotation = getIfExists(HibernateDotNames.TYPE); if (typeAnnotation == null) { // return discovered type return type; } AnnotationValue parameterAnnotationValue = typeAnnotation.value("parameters"); if (parameterAnnotationValue != null) { AnnotationInstance[] parameterAnnotations = parameterAnnotationValue.asNestedArray(); for (AnnotationInstance parameterAnnotationInstance : parameterAnnotations) { typeParameters.put( parameterAnnotationInstance.value("name").asString(), parameterAnnotationInstance.value("value").asString()); } } return typeAnnotation.value("type").asString(); }
/** * util method for String Array attribute Annotation * * @param name * @param values * @param annotationValueList */ static void stringArrayValue( String name, List<String> values, List<AnnotationValue> annotationValueList) { if (CollectionHelper.isNotEmpty(values)) { AnnotationValue[] annotationValues = new AnnotationValue[values.size()]; for (int j = 0; j < values.size(); j++) { annotationValues[j] = stringValue("", values.get(j)); } annotationValueList.add(AnnotationValue.createArrayValue(name, annotationValues)); } }
private InjectionSource getBindingSource( final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, String injectionTypeName, final EEModuleClassDescription classDescription) throws DeploymentUnitProcessingException { PersistenceUnitMetadata pu = getPersistenceUnit(deploymentUnit, annotation, classDescription); if (pu == null) { return null; } String scopedPuName = pu.getScopedPersistenceUnitName(); ServiceName puServiceName = getPuServiceName(scopedPuName); if (isPersistenceContext(annotation)) { if (pu.getTransactionType() == PersistenceUnitTransactionType.RESOURCE_LOCAL) { classDescription.setInvalid(MESSAGES.cannotInjectResourceLocalEntityManager()); return null; } AnnotationValue pcType = annotation.value("type"); PersistenceContextType type = (pcType == null || PersistenceContextType.TRANSACTION.name().equals(pcType.asString())) ? PersistenceContextType.TRANSACTION : PersistenceContextType.EXTENDED; Map properties; AnnotationValue value = annotation.value("properties"); AnnotationInstance[] props = value != null ? value.asNestedArray() : null; if (props != null) { properties = new HashMap(); for (int source = 0; source < props.length; source++) { properties.put(props[source].value("name"), props[source].value("value")); } } else { properties = null; } return new PersistenceContextInjectionSource( type, properties, puServiceName, deploymentUnit, scopedPuName, injectionTypeName, pu); } else { return new PersistenceUnitInjectionSource( puServiceName, deploymentUnit, injectionTypeName, pu); } }
/* 30: */ /* 31: */ static void stringArrayValue(String name, List<String> values, List<AnnotationValue> annotationValueList) /* 32: */ { /* 33: 65 */ if (isNotEmpty(values)) /* 34: */ { /* 35: 66 */ AnnotationValue[] annotationValues = new AnnotationValue[values.size()]; /* 36: 67 */ for (int j = 0; j < values.size(); j++) { /* 37: 68 */ annotationValues[j] = stringValue("", (String)values.get(j)); /* 38: */ } /* 39: 70 */ annotationValueList.add(AnnotationValue.createArrayValue(name, annotationValues)); /* 40: */ } /* 41: */ }
/* 188: */ /* 189: */ static void enumArrayValue(String name, DotName typeName, List<Enum> valueList, List<AnnotationValue> list) /* 190: */ { /* 191:219 */ if (isNotEmpty(valueList)) /* 192: */ { /* 193:221 */ List<AnnotationValue> enumValueList = new ArrayList(valueList.size()); /* 194:222 */ for (Enum e : valueList) { /* 195:223 */ addToCollectionIfNotNull(enumValueList, enumValue("", typeName, e)); /* 196: */ } /* 197:225 */ list.add(AnnotationValue.createArrayValue(name, toArray(enumValueList))); /* 198: */ } /* 199: */ }
/* 127: */ /* 128: */ static void classArrayValue(String name, List<String> classNameList, List<AnnotationValue> list, ServiceRegistry serviceRegistry) /* 129: */ { /* 130:158 */ if (isNotEmpty(classNameList)) /* 131: */ { /* 132:160 */ List<AnnotationValue> clazzValueList = new ArrayList(classNameList.size()); /* 133:161 */ for (String clazz : classNameList) { /* 134:162 */ addToCollectionIfNotNull(clazzValueList, classValue("", clazz, serviceRegistry)); /* 135: */ } /* 136:165 */ list.add(AnnotationValue.createArrayValue(name, toArray(clazzValueList))); /* 137: */ } /* 138: */ }
private PersistenceUnitMetadata getPersistenceUnit( final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, EEModuleClassDescription classDescription) throws DeploymentUnitProcessingException { final AnnotationValue puName = annotation.value("unitName"); String searchName = null; // note: a null searchName will match the first PU definition found if (puName != null) { searchName = puName.asString(); } PersistenceUnitMetadata pu = PersistenceUnitSearch.resolvePersistenceUnitSupplier(deploymentUnit, searchName); if (null == pu) { classDescription.setInvalid(MESSAGES.persistenceUnitNotFound(searchName, deploymentUnit)); return null; } return pu; }