@SuppressWarnings("unchecked")
    public static SerializerRegistration registerClass(Class cls, boolean failOnMiss) {
        if (cls.isAnnotationPresent(Serializable.class)) {
            Serializable serializable = (Serializable)cls.getAnnotation(Serializable.class);

            Class serializerClass = serializable.serializer();
            short classId = serializable.id();
            if (classId == 0) classId = nextId();

            Serializer serializer = getSerializer(serializerClass, false);

            if (serializer == null) serializer = fieldSerializer;

            SerializerRegistration existingReg = getExactSerializerRegistration(cls);

            if (existingReg != null) classId = existingReg.getId();
            
            SerializerRegistration reg = new SerializerRegistration(serializer, cls, classId);

            return registerClassForId( classId, cls, serializer );
        }
        if (failOnMiss) {
            throw new IllegalArgumentException( "Class is not marked @Serializable:" + cls );            
        }
        return null;
    }
Registers the specified class. The failOnMiss flag controls whether
 this method returns null for failed registration or throws an exception.
jme3-networking/src/main/java/com/jme3/network/serializing/Serializer.java