final Class<?> cls = obj.getClass() ;
final EvaluatedClassDeclaration cdecl =
(EvaluatedClassDeclaration)TypeEvaluator.getEvaluatedType(cls) ;
final MBeanSkeleton skel = getSkeleton( cdecl ) ;
AMXMetadata amd = getFirstAnnotationOnClass( cdecl, AMXMetadata.class ) ;
if (amd == null) {
amd = getDefaultAMXMetadata() ;
}
String type = skel.getType() ;
mm.info( registrationDebug(), "Stripped type", type ) ;
result = new MBeanImpl( skel, obj, server, type ) ;
if (objName == null) {
objName = skel.getNameValue( result ) ;
if (objName == null) {
objName = "" ;
}
}
if (objName.length() == 0) {
if (!amd.isSingleton()) {
throw Exceptions.self.nonSingletonRequiresName(
parentEntity, type ) ;
}
} else {
if (amd.isSingleton()) {
throw Exceptions.self.singletonCannotSpecifyName(
parentEntity, type, name ) ;
}
}