diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ManagedType.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ManagedType.java index b13be60..47fa4ad 100644 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ManagedType.java +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ManagedType.java @@ -43,6 +43,7 @@ import java.util.ArrayList; import java.util.Locale; import java.util.TreeMap; +import javax.inject.Named; import javax.inject.Qualifier; import br.gov.frameworkdemoiselle.DemoiselleException; @@ -52,6 +53,7 @@ import br.gov.frameworkdemoiselle.annotation.ManagedProperty.ManagedPropertyAcce import br.gov.frameworkdemoiselle.annotation.OperationParameter; import br.gov.frameworkdemoiselle.annotation.OperationType; import br.gov.frameworkdemoiselle.stereotype.ManagementController; +import br.gov.frameworkdemoiselle.util.NamedQualifier; import br.gov.frameworkdemoiselle.util.ResourceBundle; /** @@ -273,18 +275,29 @@ public class ManagedType { return ((ManagedType) other).getType().getCanonicalName().equals(this.getType().getCanonicalName()); } - private synchronized Annotation[] getQualifierAnnotations(Class beanClass){ - Annotation[] annotations = beanClass.getAnnotations(); + private synchronized Annotation[] getQualifierAnnotations(final Class beanClass){ + Annotation[] annotations = beanClass.getDeclaredAnnotations(); ArrayList qualifiers = new ArrayList(annotations.length); - + for (int i=0; i type){ + return type.getSimpleName().substring(0, 1).toLowerCase() +type.getSimpleName().substring(1); + } public final class FieldDetail { diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/util/NamedQualifier.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/util/NamedQualifier.java new file mode 100644 index 0000000..60ba86a --- /dev/null +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/util/NamedQualifier.java @@ -0,0 +1,69 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package br.gov.frameworkdemoiselle.util; + +import java.lang.annotation.Annotation; + +import javax.enterprise.util.AnnotationLiteral; +import javax.inject.Named; + +import util.beans.ambiguous.AmbiguousQualifier; + +/** + * Annotation litteral that allows to create instances of the {@link Named} qualifier. + * Those instances can then be used to call {@link Beans#getReference(Class type, Annotation... qualifiers)}. + * + * @see Beans + * @see Named + * + * @author SERPRO + */ +@SuppressWarnings("all") +public class NamedQualifier extends AnnotationLiteral implements Named { + + private static final long serialVersionUID = 6790759427086052113L; + + private String namedValue; + + public NamedQualifier(String value) { + namedValue = value; + } + + public String value() { + return namedValue; + } +} -- libgit2 0.21.2