public static String forExtension(EnhancedAnnotatedType<?> type) { return getPrefix(Extension.class).append(type.slim().getIdentifier().asString()).toString(); } }
public static AnnotatedTypeIdentifier forBackedAnnotatedType(String contextId, Class<?> javaClass, Type type, String bdaId, String suffix) { return new AnnotatedTypeIdentifier(contextId, bdaId, javaClass.getName(), suffix != null ? suffix : getTypeId(type), false); }
public static AnnotatedTypeIdentifier forBackedAnnotatedType(String contextId, Class<?> javaClass, Type type, String bdaId) { return forBackedAnnotatedType(contextId, javaClass, type, bdaId, null); }
Class<? super T> superclass = annotatedType.getJavaClass().getSuperclass(); if (superclass == null) { this.superclass = null; } else { this.superclass = classTransformer.getEnhancedAnnotatedType(superclass, slim.getIdentifier().getBdaId()); this.superclass = classTransformer.getEnhancedAnnotatedType(Object.class, AnnotatedTypeIdentifier.NULL_BDA_ID); ArrayList<EnhancedAnnotatedField<?, ? super T>> declaredFieldsTemp = new ArrayList<EnhancedAnnotatedField<?, ? super T>>(); Class<T> javaClass = annotatedType.getJavaClass(); if ((superclass != null) && (superclass.getJavaClass() != Object.class)) { fieldsTemp = Sets.union(fieldsTemp, Reflections.<Set<EnhancedAnnotatedField<?, ? super T>>>cast(superclass.getFields())); declaredFieldsTemp.add(weldField); for (Annotation annotation : weldField.getAnnotations()) { annotatedFields.put(annotation.annotationType(), weldField); if (annotatedField.getDeclaringType().getJavaClass().equals(javaClass)) { EnhancedAnnotatedType<?> interfaceType = classTransformer.getEnhancedAnnotatedType(interfaceClazz, slim.getIdentifier().getBdaId()); for (EnhancedAnnotatedMethod<?, ?> interfaceMethod : interfaceType.getEnhancedMethods()) { if(Reflections.isDefault(interfaceMethod.getJavaMember())) {
Class<? super T> superclass = annotatedType.getJavaClass().getSuperclass(); if (superclass == null) { this.superclass = null; } else { this.superclass = classTransformer.getEnhancedAnnotatedType(superclass, slim.getIdentifier().getBdaId()); this.superclass = classTransformer.getEnhancedAnnotatedType(Object.class, AnnotatedTypeIdentifier.NULL_BDA_ID); ArrayList<EnhancedAnnotatedField<?, ? super T>> declaredFieldsTemp = new ArrayList<EnhancedAnnotatedField<?, ? super T>>(); Class<T> javaClass = annotatedType.getJavaClass(); if ((superclass != null) && (superclass.getJavaClass() != Object.class)) { fieldsTemp = Sets.union(fieldsTemp, Reflections.<Set<EnhancedAnnotatedField<?, ? super T>>>cast(superclass.getFields())); declaredFieldsTemp.add(weldField); for (Annotation annotation : weldField.getAnnotations()) { annotatedFields.put(annotation.annotationType(), weldField); if (annotatedField.getDeclaringType().getJavaClass().equals(javaClass)) { EnhancedAnnotatedType<?> interfaceType = classTransformer.getEnhancedAnnotatedType(interfaceClazz, slim.getIdentifier().getBdaId()); for (EnhancedAnnotatedMethod<?, ?> interfaceMethod : interfaceType.getEnhancedMethods()) { if(Reflections.isDefault(interfaceMethod.getJavaMember())) {
public static String forProducerField(EnhancedAnnotatedField<?, ?> field, AbstractClassBean<?> declaringBean) { StringBuilder sb = getPrefix(ProducerField.class).append(declaringBean.getAnnotated().getIdentifier().asString()) .append(BEAN_ID_SEPARATOR); if (declaringBean.getEnhancedAnnotated().isDiscovered()) { sb.append(field.getName()); } else { sb.append(AnnotatedTypes.createFieldId(field)); } return sb.toString(); }
protected EnhancedAnnotatedConstructor<T> initEnhancedSubclass(BeanManagerImpl manager, EnhancedAnnotatedType<T> type, Bean<?> bean, ConstructorInjectionPoint<T> originalConstructorInjectionPoint) { ClassTransformer transformer = manager.getServices().get(ClassTransformer.class); EnhancedAnnotatedType<T> enhancedSubclass = transformer.getEnhancedAnnotatedType(createEnhancedSubclass(type, bean, manager), type.slim().getIdentifier().getBdaId()); return findMatchingConstructor(originalConstructorInjectionPoint.getSignature(), enhancedSubclass); }
private SlimAnnotatedType<?> tryToLoadUnknownBackedAnnotatedType() { if (identifier.getSuffix() != null || identifier.isModified()) { return null; // this is not a backed annotated type } // first, obtain the BeanManager for a given BDA final BeanManagerImpl manager = Container.instance(identifier).getBeanManager(identifier.getBdaId()); if (manager == null) { return null; } // second, try to load the class final ResourceLoader resourceLoader = manager.getServices().get(ResourceLoader.class); Class<?> clazz = null; try { clazz = resourceLoader.classForName(identifier.getClassName()); } catch (ResourceLoadingException e) { MetadataLogger.LOG.catchingDebug(e); return null; } // finally, try to load the annotated type try { return manager.getServices().get(ClassTransformer.class).getBackedAnnotatedType(clazz, identifier.getBdaId()); } catch (ResourceLoadingException e) { MetadataLogger.LOG.catchingDebug(e); return null; } } }
protected String createTypeId(RIBean<?> declaringBean) { String typeId = null; if (declaringBean instanceof AbstractClassBean<?>) { AbstractClassBean<?> classBean = (AbstractClassBean<?>) declaringBean; typeId = classBean.getAnnotated().getIdentifier().asString(); } else { typeId = declaringBean.getBeanClass().getName(); } return typeId; }
@Override public <X> SlimAnnotatedType<X> get(Class<X> type, String suffix) { for (SlimAnnotatedType<X> annotatedType : get(type)) { if (Objects.equals(annotatedType.getIdentifier().getSuffix(), suffix)) { return annotatedType; } } return null; }
public static <X> UnbackedAnnotatedType<X> modifiedAnnotatedType(SlimAnnotatedType<X> originalType, AnnotatedType<X> source, SharedObjectCache cache) { AnnotatedTypeIdentifier identifier = AnnotatedTypeIdentifier.forModifiedAnnotatedType(originalType.getIdentifier()); return new UnbackedAnnotatedType<X>(source, identifier, cache); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof BeanIdentifier) { if (this.hashCode != obj.hashCode()) { return false; } if (obj instanceof ManagedBeanIdentifier) { ManagedBeanIdentifier that = (ManagedBeanIdentifier) obj; return this.typeIdentifier.equals(that.typeIdentifier); } BeanIdentifier that = (BeanIdentifier) obj; return this.asString().equals(that.asString()); } return false; }
public static AnnotatedTypeIdentifier of(String contextId, String bdaId, String className, String suffix, boolean modified) { return new AnnotatedTypeIdentifier(contextId, bdaId, className, suffix, modified); }
public static Container instance(AnnotatedTypeIdentifier identifier) { return instance(identifier.getContextId()); }
Class<? super T> superclass = annotatedType.getJavaClass().getSuperclass(); if (superclass == null) { this.superclass = null; } else { this.superclass = classTransformer.getEnhancedAnnotatedType(superclass, slim.getIdentifier().getBdaId()); this.superclass = classTransformer.getEnhancedAnnotatedType(Object.class, AnnotatedTypeIdentifier.NULL_BDA_ID); ArrayList<EnhancedAnnotatedField<?, ? super T>> declaredFieldsTemp = new ArrayList<EnhancedAnnotatedField<?, ? super T>>(); Class<T> javaClass = annotatedType.getJavaClass(); if ((superclass != null) && (superclass.getJavaClass() != Object.class)) { fieldsTemp = Sets.union(fieldsTemp, Reflections.<Set<EnhancedAnnotatedField<?, ? super T>>>cast(superclass.getFields())); declaredFieldsTemp.add(weldField); for (Annotation annotation : weldField.getAnnotations()) { annotatedFields.put(annotation.annotationType(), weldField); if (annotatedField.getDeclaringType().getJavaClass().equals(javaClass)) { EnhancedAnnotatedType<?> interfaceType = classTransformer.getEnhancedAnnotatedType(interfaceClazz, slim.getIdentifier().getBdaId()); for (EnhancedAnnotatedMethod<?, ?> interfaceMethod : interfaceType.getEnhancedMethods()) { if(Reflections.isDefault(interfaceMethod.getJavaMember())) {
public static String forProducerField(EnhancedAnnotatedField<?, ?> field, AbstractClassBean<?> declaringBean) { StringBuilder sb = getPrefix(ProducerField.class).append(declaringBean.getAnnotated().getIdentifier().asString()) .append(BEAN_ID_SEPARATOR); if (declaringBean.getEnhancedAnnotated().isDiscovered()) { sb.append(field.getName()); } else { sb.append(AnnotatedTypes.createFieldId(field)); } return sb.toString(); }
protected EnhancedAnnotatedConstructor<T> initEnhancedSubclass(BeanManagerImpl manager, EnhancedAnnotatedType<T> type, Bean<?> bean, ConstructorInjectionPoint<T> originalConstructorInjectionPoint) { ClassTransformer transformer = manager.getServices().get(ClassTransformer.class); EnhancedAnnotatedType<T> enhancedSubclass = transformer.getEnhancedAnnotatedType(createEnhancedSubclass(type, bean, manager), type.slim().getIdentifier().getBdaId()); return findMatchingConstructor(originalConstructorInjectionPoint.getSignature(), enhancedSubclass); }
private SlimAnnotatedType<?> tryToLoadUnknownBackedAnnotatedType() { if (identifier.getSuffix() != null || identifier.isModified()) { return null; // this is not a backed annotated type } // first, obtain the BeanManager for a given BDA final BeanManagerImpl manager = Container.instance(identifier).activityManager(identifier.getBdaId()); if (manager == null) { return null; } // second, try to load the class final ResourceLoader resourceLoader = manager.getServices().get(ResourceLoader.class); Class<?> clazz = null; try { clazz = resourceLoader.classForName(identifier.getClassName()); } catch (ResourceLoadingException e) { MetadataLogger.LOG.catchingDebug(e); return null; } // finally, try to load the annotated type try { return manager.getServices().get(ClassTransformer.class).getBackedAnnotatedType(clazz, identifier.getBdaId()); } catch (ResourceLoadingException e) { MetadataLogger.LOG.catchingDebug(e); return null; } } }
protected String createTypeId(RIBean<?> declaringBean) { String typeId = null; if (declaringBean instanceof AbstractClassBean<?>) { AbstractClassBean<?> classBean = (AbstractClassBean<?>) declaringBean; typeId = classBean.getAnnotated().getIdentifier().asString(); } else { typeId = declaringBean.getBeanClass().getName(); } return typeId; }
@Override public <X> SlimAnnotatedType<X> get(Class<X> type, String suffix) { for (SlimAnnotatedType<X> annotatedType : get(type)) { if (Objects.equals(annotatedType.getIdentifier().getSuffix(), suffix)) { return annotatedType; } } return null; }