All implementations (ArC, Weld, OWB) have a notion of bean identifier. The identifier is unique for all beans in the "current" deployment. In Weld, it seems it's unique across deployments as well. ArC doesn't support multiple concurrent deployments, so it's easy there. It is not unique across deployments in OWB, which feels fine, I don't think we need that. It's typically a String; in one case when it's not (Weld), there's a method to convert it to String, so that feels like a decent type. It feels useful to expose it through the standard API.
I see 2 concerns immediately:
- To not break previous custom implementations of
Bean, the method should be default. However, there's really no good default value. It doesn't feel right to return null or throw an exception, and it doesn't feel right to make it non-default.
- There's an interface
PassivationCapable that already exposes the getId() method. But this interface comes with extra contracts that are not defined by the prescribed methods. It doesn't feel right to let all beans implement PassivationCapable. We could possibly move the method to Bean and leave PassivationCapable as a marker interface, but the javadoc indicates that custom implementation of Contextual can also be PassivationCapable, so either we would have to move getId() to Contextul, or leave it in PassivationCapable as well.
Overall it feels like more trouble than what it's worth, but I'm interested in other opinions.
All implementations (ArC, Weld, OWB) have a notion of bean identifier. The identifier is unique for all beans in the "current" deployment. In Weld, it seems it's unique across deployments as well. ArC doesn't support multiple concurrent deployments, so it's easy there. It is not unique across deployments in OWB, which feels fine, I don't think we need that. It's typically a
String; in one case when it's not (Weld), there's a method to convert it toString, so that feels like a decent type. It feels useful to expose it through the standard API.I see 2 concerns immediately:
Bean, the method should bedefault. However, there's really no good default value. It doesn't feel right to returnnullor throw an exception, and it doesn't feel right to make it non-default.PassivationCapablethat already exposes thegetId()method. But this interface comes with extra contracts that are not defined by the prescribed methods. It doesn't feel right to let all beans implementPassivationCapable. We could possibly move the method toBeanand leavePassivationCapableas a marker interface, but the javadoc indicates that custom implementation ofContextualcan also bePassivationCapable, so either we would have to movegetId()toContextul, or leave it inPassivationCapableas well.Overall it feels like more trouble than what it's worth, but I'm interested in other opinions.