Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
851 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericProduct.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2010, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jboss.weld.extensions.bean.generic; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.PARAMETER; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import javax.enterprise.util.AnnotationLiteral; | ||
import javax.inject.Qualifier; | ||
|
||
/** | ||
* Allows the product of the generic producer to be injected back into the generic bean | ||
* | ||
* <ul> | ||
* <li>Only works on injected fields</li> | ||
* </ul> | ||
* | ||
* @author Pete Muir | ||
* | ||
*/ | ||
@Retention(RUNTIME) | ||
@Target({METHOD, FIELD, PARAMETER, TYPE}) | ||
@Qualifier | ||
public @interface GenericProduct | ||
{ | ||
|
||
static class GenericProductLiteral extends AnnotationLiteral<GenericProduct> implements GenericProduct | ||
{ | ||
|
||
private static final long serialVersionUID = 2768505716290514234L; | ||
|
||
|
||
|
||
private GenericProductLiteral() {} | ||
|
||
} | ||
|
||
static final GenericProduct INSTANCE = new GenericProductLiteral(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Garply.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2010, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jboss.weld.extensions.test.bean.generic.field; | ||
|
||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Inject; | ||
|
||
import org.jboss.weld.extensions.bean.generic.Generic; | ||
import org.jboss.weld.extensions.bean.generic.GenericProduct; | ||
|
||
/** | ||
* A generic bean for the config annotation Message | ||
* | ||
* @author pmuir | ||
* | ||
*/ | ||
|
||
@Generic(Service.class) | ||
public class Garply | ||
{ | ||
|
||
@Inject @GenericProduct | ||
private Waldo waldo; | ||
|
||
@Produces @WaldoName | ||
public String getWaldoName() | ||
{ | ||
return waldo.getName(); | ||
} | ||
|
||
public Waldo getWaldo() | ||
{ | ||
return waldo; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.